MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Wolfram LinkLibrary and additional dll on Windows

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121945] Wolfram LinkLibrary and additional dll on Windows
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Fri, 7 Oct 2011 04:45:46 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi,

I have a package which has its number crunching algorithms in a C++ library which is connected to Mathematica through the LibraryLink. Inside my algorithms I use the Intel Threading building blocks
[1] heavily. I have this library compiled for Linux, Mac OSX and Windows and inside each LibraryResources directory, I distribute the tbb.{so | dylib | dll}. Everythings works fine except for 2 Windows machines.
On those two machines the Intel compiler tools are not installed and therefore, my lib has to rely on the
tbb.dll which is distributed in the same directory.

Loading the package brings up an error dialog, that says that the tbb.dll could not be found.

1. Using FindLibrary["tbb"] brings up the correct path inside my package.

2. Taking any arbitrarily chosen function from the tbb and register it with, for instance

LibraryFunctionLoad["tbb", "TBB_runtime_interface_version", {}, Integer];

and *then* loading my package, works without error.

3. Trying to put this preload inside the WolframLibrary_initialize function with something like

#if defined(_WIN32) || defined(_WIN64)
	tbbLib = LoadLibrary("tbb.dll");
	if(tbbLib != NULL) {
		tbbInitializeFunctionType version = (tbbInitializeFunctionType) GetProcAddress(tbbLib,
			"TBB_runtime_interface_version");
		char msg[100];
		sprintf(msg,"Die TBB version ist: %d\n",version());
		lib->Message(msg);
	}
#endif

does not work. Maybe important at this point is, that there is no longer an "error dialog" coming up. There
is now only an Mathematica error message saying, that the library function could not be loaded. I assume my
dll is crashed silently. On the other
windows machines with the intel compiler installed everything works fine and the version number is displayed
when the library is loaded first.

4. The dependency walker says that everything is fine with my library. No wrong modules and the tbb comes from the directory
where my library is located

5. Trying to profile math.exe with the dependency walker and loading my package does not bring any useful information.
In fact, I don't see any dlopen or whatsoever when I load my package. This *suggests* that the tbb is not found in the first
place, but this is only a guess and I don't understand this.


I'm not a Windows guy and I'm not a soldier in the dll-hell, so can someone please give me a helping hand here or point me to
some useful documentation? Do I maybe need to create a special manifest file? Does it make a difference whether a
dll is not loaded by Mathematica directly, but through another dll?

Currently I'm out of ideas how to track this down.

Cheers
Patrick

[1] http://software.intel.com/en-us/articles/intel-tbb/


  • Prev by Date: Re: Extra parameter for DirichletDistribution
  • Next by Date: Re: average of the consecutive coin tosses
  • Previous by thread: Re: Mathematica
  • Next by thread: Re: Wolfram LinkLibrary and additional dll on Windows