Search This Blog

Monday, April 30, 2012

Dependency walker handy utility


I was helped out of a jam by a free utility dependencywalker

I've been using libusb for instrument control from Java on windows.  Recently I had a machine
that just would not run the GUI control program that works on my other machines.   In netbeans I'd get this error:

C:\Program Files\Java\jdk1.6.0_24\jre\bin\LibusbJava.dll: Can't find dependent libraries

Google let me to stackoverflow and then to this handy utility
http://www.dependencywalker.com/

It opens the dll and shows you all the functions inside and the dependancies.  It told me immediately
that I was missing libusb0.dll.  

LibusbJava.dll
-Kernel32.DLL
-MSVCRT.DLL
-LIBUSB0.DLL

I had already found libusb0.dll on the web, and didn't know if i needed it.  Now I know I do.  I put it along with libusbjava.dll in the Java bin directory in my jdk.
C:\Program Files\Java\jdk1.6.0_24\jre\bin

It didn't work.   I ran dependencywalker again, and
I immediately noticed it was 64 bit not 32 bit dll.  Netbeans is 32 bit so it was the wrong version.

Downloaded it again.  You can get libusb-win32 from here
http://sourceforge.net/apps/trac/libusb-win32/wiki

Tried again.  Didn't work.  Read the readme, found out that libusb0.dll needs to be in the
Windows/system32/ directory.   Bingo, now it works!

This probably should have happened when I ran
\libusb-win32-bin-1.2.6.0\bin\inf-wizard,  but it seems it didn't.