This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Using CNI to call compiled java from C++
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Stephane MILLET <stef dot millet at wanadoo dot fr>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 21 Oct 2003 17:46:28 -0400 (EDT)
- Subject: Re: Using CNI to call compiled java from C++
On Tue, 21 Oct 2003, Stephane MILLET wrote:
> I'm working on a C++ application and wanted to use Java code in it. To
> do that, i've been trying to use CNI functions to call compiled java
> code with their gcjh produced headers. I first create the JVM, then
> attach the current thread as defined in the manual. Then, when I need a
> particular java class instance, i do a new in C++ and use the instance.
> But, how and when will this object be deleted ?
That's up to the GC.
> The GC doesn't seem to care about it.
What do you mean by that? Do you have some evidence that it is never
deleted? (Example: your application's memory use grows without bound, or a
finalizer is never called after you know a collection has taken place, or
...)
> Otherwise, is this use of CNI and GCJ the right use ?
Hard to say. Sounds like you're on the right track but unless you give us
a code example we can't say if it's right or wrong.
Jeff