C++ accessing GCJ

Bryce McKinlay mckinlay@redhat.com
Fri Apr 8 23:52:00 GMT 2005


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


More information about the Java mailing list

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