Click here to Skip to main content
15,868,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JNI_CreateJavaVM(&jvm, (void **)&env, &args);

VB
tcc C:\TurboC++\Disk\TurboC3\BIN\CTest.c -I "C:\Program Files\Java\jdk1.6.0_16\include" -I "C:\Program Files\Java\jdk1.6.0_16\include\win32" -I "C:\Program Files\Java\jdk1.6.0_16\lib" -shared -o CTest.dll

Error: tcc: undefined symbol '_JNI_CreateJavaVM@12'



please help me out.
Posted

1 solution

You have to link with JVM's library (add some reference to libjvm.a to the tcc's command line).

If you don't have a precompiled jvm.lib file for TurboC++, there is another option - link with the jvm.dll file and export all the methods from JVM manually. This uses the LoadLibrary/GetProcAddress functions.

For a short sample look at this:
C++
/* load library */
HMODULE dll = LoadLibraryA("jvm.dll");

/* declare a function pointer and initialize it with the "pointer" to dll's code */
JNI_CreateJavaVM_func JNI_CreateJavaVM_ptr = GetProcAddress(dll, "JNI_CreateJavaVM");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900