Search code examples
javadebuggingdlljna

JNA Unable to load module - output debug information (dependencies)


I want to load a .dll file (simpleDLL.dll form a jna tutorial) but i get

java.lang.UnsatisfiedLinkError: Unable to load library 'simpleDLL': The specified module could not be found.

I run the java program with wine under ubuntu and I got this information:

err:module:import_dll Library MSVCR100D.dll (which is needed by ...

This message was not displayed when running the program in Eclipse, so my question is:

Is there a way to set a more detailed debug level for JNA, so that dependent .dll files can be displayed when trying to load a module ? (I wasted a lot of time thinking that somehow, the jna.library.path is not correctly set and actually, no information was printed regarding other .dll files needed).


Solution

  • You get more detailed information from wine because that system chooses to implement a more descriptive error message than does the windows OS. You can't magically force windows to behave like wine.

    wine emulates windows (i.e. in order to function properly, it must mimic windows exactly). Apparently in some cases it provides better error reporting, although I doubt your err:module:import_dll message came through the normal win32 error text lookup without additional tweaking, or wine wouldn't be doing its job of emulating windows very well.

    Windows, on the other hand, will not report more information about DLL dependencies until Microsoft changes it to do so, which isn't likely to happen, ever.