Search code examples
c++visual-c++java-native-interface

C++ DLL does not run on different machine


I am developing a simple c++ application to generate a dll which later I am using in JNI to run native api calls, but the thing is the dll works well on the machine which I used to develop the dll but does not on the server. Both machines run Windows 7.

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
    at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.UnsatisfiedLinkError: de.deltacontrols.enteliprint.printer. PrinterService.getStatus(Ljava/lang/String;)I


Solution

  • On machine it doesnt work open your dll in dependency walker. Examine the out put for errors, it is possible that you are using debug version of your dll which works fine on machine with visual studio or it maybe c++ redistributable which is missing on target machine