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:
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).
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.
I don't think you can use LibraryLink to call 32 bit code from a 64 bit operating system.
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.