3 messages in net.java.dev.jna.usersRe: [jna-users] Error while loading l...
FromSent OnAttachments
Schneider JannApr 22, 2009 4:11 am 
Timothy WallApr 22, 2009 6:12 am 
Schneider JannApr 22, 2009 6:18 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Error while loading libraryActions...
From:Timothy Wall (twal@dev.java.net)
Date:Apr 22, 2009 6:12:45 am
List:net.java.dev.jna.users

If you use the absolute path to the library, you need to provide the full path name, including the ".dll" suffix.

JNA uses LoadLibraryEx with a flag indicating that the dependent library search should start in the same directory as the dll, so once you load the first library, the others should be found properly if they are in the same directory.

On Apr 22, 2009, at 7:11 AM, Schneider Jann wrote:

Hi all,

I'm new to this list and hope this is the right place to ask the below questions. If not, please point me to the right one instead.

I created an Dll called Win32GigECamController.dll which provides communication and controling of GigE Cameras. This dll is developed with MS Visual Studio 2008 pro. Therefore it makes a dependency to the MS CRT. Also it uses some 3rdth party libs which are loaded at runtime.

The structure: I created an deploy folder containing the Win32GigECamController.dll and also the objects generated by Visual Studio when building this dll. So in detaill i have the dll, the manifest file, an lib file an exp file and the pdb one. Also i dropped in the folder, containing the ms crt. Aftterwards i customized the manifest files like this: In the ms crt manifest file i simply removed the public key token. And in the Win32GigECamController.dll.manifest file i adjusted the version of the dependend ms crt library and also removed the public key tokens.. This is neccessary to ensure while loading the dll's from the deploy folder will be used instead of using the ones in the WinSxs directory.

What i tried: I created a test application which loads this dll via LoadLibrary and gets a pointer to a function of this dll via GetProcAddress and calls this function successfully. I droped this exe and the according objects and manifest file into the deploy folder and customized the TestApplication.exe.manifest file like the Win32GigECamController.dll.manifest file. So that it points to the right version of ms CRT. When i run this test app, everything works fine. It finds the dll in the current folder and can load and execute the function of it. No i wanted to load this dll in the Java project. Therefore i created the according interface which holds an loaded Instance of the dll loaded via Native.loadLibrary(String, String) like described in the jna docu. As dll name i provided the absolute path to the dll except the suffix .dll. Now when i run my JUnit test to check loading of this dll i get an java.lang.UnsatisfiedLinkError: "libname" unable to load module

I guess it's a problem with search paths perhaps? or something else i don't have in mind right now .. :-)

Any help would be greatly appriciated.

Regards Jann