Click here to Skip to main content
Rate this: bad
good
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 19:13pm

1 solution

Rate this: bad
good
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");
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 6,212
1 OriginalGriff 5,498
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
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