This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking with JNI Invoke Using Cygwin gcc


I have written a DLL and a test program that uses the JNI api to invoke a
JVM.  When I try to link with a test program, I get an error indicating that
a reference to __imp__JNI_CreateJavaVM@12 is undefined.

$ export JAVA_HOME=/cygdrive/c/j2sdk1.4.1_02
$ g++ -c ?I$JAVA_HOME/include ?I$JAVA_HOME/include/win32 JavaGateway.c++
$ g++ -I$JAVA_HOME/include ?I$JAVA_HOME/include/win32 ?L$JAVA_HOME/lib \
-ljvm JavaGateway.o -o testGateway testGateway.c++

The link command above produces these errors:

JavaGateway.o(.text+0x171):JavaGateway.c++: undefined reference to
`__imp__JNI_CreateJavaVM@12'
JavaGateway.o(.text+0x251):JavaGateway.c++: undefined reference to
`__imp__JNI_CreateJavaVM@12'
collect2: ld returned 1 exit status

I assume that the jvm.lib file provided with the sdk was compiled with MS
VC++.  Does the cygwin gcc compiler massage the symbol references
differently from MS?  Does anyone have a suggestion on how I can make this
work?

Thanks,

Tom


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]