I am currently struggling to compile a Dll for JNI use, using Eclipse CDT and MinGW.
Following a tutorial, i created a Java class that declares native methods, then used javah to get the relevant header file and I implemented it in a C++ class.
The C++ code is very simple and compilation works, but when I load the library into the Java class, i get this error :
Exception in thread "main" java.lang.UnsatisfiedLinkError: Main.integerMethod(I)I
at Main.integerMethod(Native Method)
at Main.main(Main.java:12)
I "explored" the dll and found out that the methods that should be called all have a suffix like "@14". The problem is, I am already using the -Wl,--kill-at compiler option which should remove these very embarassing tags... So why is it not working ?
The compilation log is following :
**** Rebuild of configuration DLL for project JniCTest ****
**** Internal Builder is used for build ****
g++ -IC:\Program Files\Java\jdk1.6.0_13\include -IC:\Program Files\Java\jdk1.6.0_13\include\win32 -O3 -Wall -c -fmessage-length=0 -mno-cygwin -D__int64=long long -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -oMain.o ..\Main.cpp
g++ -o libJniCTest.dll -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at -shared -olibJniCTest.dll Main.o
Build complete for project JniCTest
Time consumed: 375 ms.
Is there something wrong about the compiler options ? Thanks for any help.