This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I'm trying to call C (not C++) functions from GCJ compiled Java via jni (these are functions I'm currently using with regular interpreted Java, which is why I'd prefer not to switch to CNI). I ran gcjh and recompiled the C functions (with the -D_REENTRANT option) and put the binaries into a library ('ld -shared ...')
The header generated by gcjh looks like C to me, but when I try to link this library against gcj compiled java, it looks as if gcj is looking for C++.
I.e. from my class Locfit.java, gcjh generates names for two functions,
extern void Java_locfit_Locfit_jniLocfit (They refer to two C functions in one file, which gets compiled and put into library liblocfit.so
JNIEnv *env, jobject, jint,
jdoubleArray,,jdoubleArray, jdouble, jint, jint, jint, jdoubleArray);extern void Java_locfit_Locfit_jniSetup (JNIEnv *env, jclass);
Then after compiling the calling java classes
gcj -c --no-bounds-check -O3 -g0 SimRunner.javalinking
gcj -c --no-bounds-check -O3 -g0 Locfit.java
gcj --main=liveT.SimRunner -o SimRunner SimRunner.o Locfit.o liblocfit.soyields the error messages
/home/moi/JavaTree/locfit/Locfit.o: In function `locfit::Locfit::_003cclinit_003e(unsigned)':It looks like the linker is looking for C++ references. Of course in the library, the names are
/home/moi/JavaTree/locfit/Locfit.o(.text+0x383): undefined reference to `locfit::Locfit::jniSetup(void)'
/home/moi/JavaTree/locfit/Locfit.o(.data+0x20c): undefined reference to `locfit::Locfit::jniLocfit(int, JArray<double> *, JArray<double> *, double, int, int, int, JArray<double> *)'
/home/moi/JavaTree/locfit/Locfit.o(.data+0x21c): undefined reference to `locfit::Locfit::jniSetup(void)'
/home/moi/JavaTree/locfit/Locfit.o(.data+0x29c): undefined reference to `locfit::Locfit::jniLocfit(int, JArray<double> *, JArray<double> *, double, int, int, int, JArray<double> *)'
collect2: ld returned 1 exit status
make: *** [SimRunner] Error 1
00057380 T Java_locfit_Locfit_jniLocfitI'd greatly appreciate any suggestions about how to get this working.
000576b0 T Java_locfit_Locfit_jniSetup
Thanks,
Barnet Wagman
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |