Click here to Skip to main content
12,951,619 members (55,708 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Top Experts
Last 24hrsThis month
OriginalGriff 6,084
CHill60 3,480
Maciej Los 3,083
Jochen Arndt 1,975
ppolymorphe 1,830


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2017
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