This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: C++ accessing GCJ
- From: Bryce McKinlay <mckinlay at redhat dot com>
- To: Scott Serr <sserr at amis dot com>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 08 Apr 2005 19:52:31 -0400
- Subject: Re: C++ accessing GCJ
- References: <42571427.4000209@amis.com>
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