Re: Wolfram LinkLibrary and additional dll on Windows
- To: mathgroup at smc.vnet.net
- Subject: [mg121990] Re: Wolfram LinkLibrary and additional dll on Windows
- From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
- Date: Sat, 8 Oct 2011 05:33:24 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j6melm$7dj$1@smc.vnet.net> <op.v2zvv9reqcgwdu@core2.lan>
On Fri, 07 Oct 2011 19:49:11 +0100, Oleksandr Rasputinov <oleksandr_rasputinov at hmamail.com> wrote: > > The issue may be that LoadLibrary("tbb.dll") fails due to not locating > tbb.dll on the search path--note that Windows's search path and > Mathematica's $LibraryPath are in general very different (for example, > on my system they contain nothing in common). If this is the case, then > as I see it you have at least three options: > > 1. set the Windows search path to $LibraryPath using SetDllDirectory() > before calling LoadLibrary() (here I assume that you would rather not > hard-code a fully qualified path due to possible difference between > installations); > 2. load the library using LoadLibrary(), but giving a fully qualified > path to the file as found by FindLibrary[]; > 3. use LoadLibrary["tbb.dll"] as part of your package initialization to > have Mathematica do this for you before you load your own library. > > Of these, option 3 seems preferable to me. Actually, I'm surprised that > LibraryFunctionLoad worked on tbb.dll considering that this will not > contain any WolframLibrary_initialize function or indeed adhere to the > Wolfram Library specification in any other respect. Sorry: in option 3, LoadLibrary["tbb.dll"] should (obviously?) be LibraryLoad["tbb.dll"]. I had mixed up the similarly named Windows function with the Mathematica one. In fact, LibraryLoad["tbb"] is probably better than LibraryLoad["tbb.dll"], as this should work on all platforms provided that the library can actually be found somewhere in $LibraryPath.