Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling JVM from C native code

843829Nov 12 2001 — edited Nov 13 2001
I'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.


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2001
Added on Nov 12 2001
1 comment
168 views