Calling JVM from C native code
843829Nov 12 2001 — edited Nov 13 2001I'd like to call JVM from C native call.
I work in W2000 enviroment using GCC Cygnus compiler.
I followed JNI instructions.
I read in this forum there was a change in JDK, and instead of attaching javai.dll, jvm.dll must be attached.
Then I made a test using invoke.c example from JDK.
I built following .bat file:
gcc -c invoke.c -Id:\jdk1.3.1\include -Id:\jdk1.3.1\include\win32
DLLTOOL dllname jvm.dll def libjvm.def --output-lib d:\jdk1.3.1\jre\bin\classic\libjvm.a
c++ -o invoke.exe invoke.o -Ld:\jdk1.3.1\jre\bin\classic -ljvm
with libjvm.def :
EXPORTS
imp_JNI_GetDefaultJavaVMInitArgs@4
imp_JNI_CreateJavaVM@12
All seems to work fine, and invoke.exe is generated. But when trying to run it, I get a windows message telling me :
invoke.exe doesn't find the entry point to imp_JNI_CreateJavaVM@12 in jvm.dll.
What am I going wrong ?
Any calling convention issue ?
Thanks in advance. Ignasi Villagrasa.