GCJ .jar to .so with native method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I'm running into some problems converting a Java library (i.e., .jar
file) into a native shared library (i.e., .so file) and then using that
library with g++. In particular, I have a native method in the .jar file
that I can't figure out how to define to the linker's satisfaction. I'm
using GCC 4.1.2 on Linux.

If I modify the gcjh-generated header file and define the native method
inline (e.g., virtual void receive(JArray< jbyte > *, jint) {} ) the
linker still complains about an undefined reference for the native
method:

.//libricochet.so: undefined reference to `void
multishot::examples::RicochetApp::receive(JArray<char>*, int)'
collect2: ld returned 1 exit status

If I define the native method outside of the header file (e.g., in a C++
source file like so:
void multishot::examples::RicochetApp::receive(JArray< jbyte > *, jint)
{} ) then the linker complains about a hidden symbol:

/usr/bin/ld: RicochetApp: hidden symbol `void
multishot::examples::RicochetApp::receive(JArray<char>*, int)'
in .obj/RicochetAppMain.o is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output

Any ideas as to what I need to do to rectify my problem would be greatly
appreciated.

Thanks!

-Joe


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux