[Date Index] [Thread Index] [Author Index]
Re: Wolfram LinkLibrary and additional dll on Windows
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.