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]
Other format: [Raw text]

Re: C++ accessing GCJ


Scott Serr wrote:

We've been diving into GCJ for about a week. We would like to do the majority of a project in Java but allow others to have hooks into it with C++ and TCL.

I have two questions.

1. When accessing a Java class from C++, why is there Jv* setup and tear-down? Seems like when you have that Java class in a .so... it would be indistguishable from an .so generated from C/C++.


JvCreateJavaVM() is needed to initialize runtime services such as the garbage collector, and otherwise set up the environment that Java code needs to run. While it might be possible to have an implicit runtime initialization check every time C++ code called in to Java, this would be inefficient. It might also be possible to have the initialization run automatically when libgcj.so is loaded, but this would inhibit user arguments being passed to the runtime at initialization time.

See http://gcc.gnu.org/onlinedocs/gcj/Invocation.html#Invocation for more information.

Bryce


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