On Jul 30, 2007, at 4:55 AM, pzab...@poczta.onet.pl wrote:
I changed for a while the abstract class into interface in order to
check if this is the reason of the problem.
Well, it won't work at all with an abstract class, that's for sure.
I also included the full path to my cpp dll. I exported static
functions for it (in order to avoid any problems connected to
decorated export from exported classes).
The exported methods must be declared 'extern "C"' if you're
compiling the code as C++. There is a FunctionMapper in JNA to
handle __stdcall-decorated names (e.g. _MyFunction@8) if you haven't
remapped the symbols to be undecorated.
So, now I have:
package jnatest;
import com.sun.jna.Library;
import com.sun.jna.Native;
public interface testJNADllInterface extends Library {
testJNADllInterface INSTANCE =
(testJNADllInterface)Native.loadLibrary ("D:/MyPath/
CPPDynamicLibToBeCalledViaJNA.dll", testJNADllInterface.class);
int SetValue(int i);
}
and I am using this interface this way:
testJNADllInterface lib = testJNADllInterface.INSTANCE;
lib.SetValue(1);
for(int i=0;i<5;i++){
lib.SetValue(i);
}
The Eclipse PlugIn hungs on:
testJNADllInterface lib = testJNADllInterface.INSTANCE;
If you attach to the process with Visual Studio, what do you see the
program doing? Do you have a DllMain (you don't necessarily need
one)? Does your library have static initializers? Can you call
LoadLibrary on it from a simple C program?