Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ C Java JNI
JNI_CreateJavaVM(&jvm, (void **)&env, &args);
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 19-Feb-13 20:13pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
/* 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");

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

  Print Answers RSS
0 Maciej Los 475
1 OriginalGriff 425
2 Sascha Lefévre 289
3 CPallini 285
4 CHill60 260
0 Sergey Alexandrovich Kryukov 9,773
1 OriginalGriff 9,290
2 Peter Leow 5,137
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,036

Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100