This is the mail archive of the java@gcc.gnu.org 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]

Calling java code from C/C++ code.


Is it possible to use gcj to generate a shared object which can be
loaded (via dlopen/dlsym) and invoked from a C/C++ program?

I've been attempting to do this with the following:
g++ -g -o loader loader.cc -ldl # program which loads the shared object
g++ -fPIC -shared -o testi.o test.cc # similar to what jvgenmain
produces
gcj -fPIC -shared -o testj.o -c test.java # simply hello world main
routine
ld -shared -soname test.so -o test.so testi.o testj.o -lgcj -lgcjgc
-lzgcj

When "loader" is run, a SEGV is raised in the GC
(GC_mark_from_mark_stack) during C++ static initialization (i.e. _init).

I am working from the FSF head (not the 3.0 branch).

Is what I'm doing feasible?  If so, what am I missing about the GC?

Thanks
Tim Wall


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