Message Boards Message Boards

0
|
4229 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Incompatibiity between ACE and LibraryLink

Posted 11 years ago

I have a 32-bit library I would like to use some functions from that use the ACE library (http://www.cs.wustl.edu/~schmidt/ACE.html). Central to the task of making this work is the initialization of the ACE library. From a DLL, this is done with a call to ACE::init(). There are a number of examples of doing this and I have done it with a number of other programs. In the WolframLibrary_initialize() routine, I call ACE::init() and it fails. I have also tried putting the ACE::init() into the DLLMain routine--no luck. Most of what the ACE::init() does is allocate a bunch of C++ objects and initialize a number of static global variables. Some simple stuff works, like just returning a string, or getting the arguments from the called function.

This is a Windows 7 machine with 64-bit OS. I have set my notebook to use a 32-bit kernel so that I can load my 32-bit library. It has a number of other 32-bit dependencies. I can think of a couple of things that might be going wrong:

  1. The WolframLibrary_initialize() is not happening in the same thread as the original Win32 LoadLibrary call.
  2. The 32-bit kernel does not have the %PATH% I think it does.
  3. There is something else I need to do to get a 32-bit DLL to load its dependencies (they are all in the same dir as the one I built).
  4. I need to build the library with something later then Visual C++ 6.0
  5. C++ static variable initialization is problematic with LibraryLink.

Any ideas?

POSTED BY: winston jenks
4 Replies

I don't think you can use LibraryLink to call 32 bit code from a 64 bit operating system.

POSTED BY: Frank Kampas
Posted 11 years ago

Sure we can. The OS is not the problem in this case. What's important is the "bit-ness" of the Process, not the OS. That is why there is a 32-bit kernel. The library loads, and the functions are loaded with LibraryFunctionLoad just fine. The one that returns the version works.

POSTED BY: winston jenks

On a 64 bit OS, you're running a 64 bit version of Mathematica.
If my memory is correct, technical support has told me you can't call a 32 bit dll from 64 bit Mathematica through LibraryLink.

POSTED BY: Frank Kampas
Posted 11 years ago

I tried it with the 64-bit version of my DLL. Originally I got the same behavior as with the 32-bit version--if I did not include any dependencies to other DLLs, it worked fine, but as soon as I tried to call something in another library, it would not load. Then I explicitly put the location of the other required DLLs in the PATH. Now the 64-bit version of my DLL works just fine. Next I'll try to get the 32-bit version working (with the 32-bit kernel).

POSTED BY: winston jenks
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract