• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNI try to Access native DLL and get Can't find dependent librarie

 
ashish donvir
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have Visual Studio 2010 installed and have a c++ project( or Driver)which I got with my hardware which I can build successfully without any errors. I get a Wrapper.dll, which I would like to access using JNI in order to use with java as my whole application is in java. I am using Win7 64-bit.

But I get the error: java.lang.UnsatisfiedLinkError: Unable to load library 'Wrapper': The specified module could not be found.

Wrapper.dll of course is in the correct folder and it is a 32-bit dll and my Java program also uses a JRE with 32-bit, so this is not the cause of the error.

I used DependencyWalker to check whether *.dlls are missing: And I got these dll missing

MSVCR80.DLL
IESHIMS.DLL
GPSVC.DLL

And yes there are some missing. Can I conclude that the error is related with that these DLLs are missing? But why does Visual Studio compile correctly then and does not throw an error? How to solve this in order to access these functions in Wrapper.dll?

I also read that downloading dll's might not be the right thing to do! (I know that Wrapper.dll relies on another dll or sourcecode which was built in Visual Studio 2005, if that is of interest.)



I found out, that Wrapper.dll relies on three other dlls which probably were built on MSVS2005. These require the above mentioned DLL's (checked with dependencywalker) and I guess therefore Wrapper.dll also links them.

So what do I actually do to get rid of these old dll's? Would I need to build the other three DLLs with VS2010 or is this a problem which always will appear, meaning, that you need to copy paste old DLLs in order to use the precompiled Libraries which are dependent on those.

Is there a way, that the program would run on any other system as well without copy pasting these DLL's?
Is This A Good Question/Topic? 0
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this question isn't in any way related to Swing / AWT / SWT / JFace, I'm moving the thread to General Computing.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I conclude that the error is related with that these DLLs are missing?

Yes. Unfortunately the error message never tells you exactly which DLL is missing - it could be either that it cannot find the DLL you specified, or it cannot find a DLL upon which that DLl depends. You might be able to use Process Monitor from sysinternals to see which DLLs the JVM is attempting to open, and thus determine which one was missing.

But why does Visual Studio compile correctly then and does not throw an error?

That depends on a number of things. Andi t has a lot do do with what kind of DLLs they are (.NET, or plain C/C++). Usually, with C/C++ development, all you need is the header files and .lib file to make the compiler and linker happy. It's not until you run the app that you need to .dll file.

Essentially, you will need those DLLs unless you can modify Wrapper.dll to no longer rely on them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic