invoke GCJ .o files from C/C++ program

Jeff Sturm jeff.sturm@appnet.com
Wed Jul 5 15:42:00 GMT 2000


Cecilia Vy-Ai Le wrote:
> I build a static library which 'ar' all object files
> generated by: gcj -c javafiles.java
> Now, I am try to invoke this library from my C/C++
> main program.
> Would you please to tell me that it is possible to
> invoke the library via JNI invocation?

What version of gcj/libgcj did you use? If you downloaded 2.95.1, JNI
will not be available. (You can get a working JNI from recent snapshots
of the compiler and library.)
JNI will not resolve classes at compile time, so you must find another
way to get your classes linked from the static archive, or use a shared
library instead.
You may find it simpler and easier to use the CNI interface. It allows
you to create and invoke Java objects directly from C++ code. With CNI
you must use a Java main() method for program startup, not a C/C++
main() function. But this startup class may simply invoke the rest of
your C++ app.
--
Jeff Sturm
jeff.sturm@appnet.com


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /