This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Using gcj as an extension language
- From: Tom Tromey <tromey at redhat dot com>
- To: atai at atai dot org
- Cc: java at gcc dot gnu dot org
- Date: 18 Dec 2002 13:38:22 -0700
- Subject: Re: Using gcj as an extension language
- References: <20021218202017.41334.qmail@web10503.mail.yahoo.com>
- Reply-to: tromey at redhat dot com
>>>>> "Andy" == Andy Tai <atai@atai.org> writes:
Andy> Hi, this is just a general question about gcj... How well can
Andy> gcj be used as an extension language, in the sense of guile?
Fairly well, though this isn't the usual approach. Ordinarily you'd
write your main program in java and have a bunch of C support
libraries with java wrappers.
Still, you can use the JNI invocation API to drive libgcj.
Andy> Is the gcj runtime thread safe? Can I call into the runtime
Andy> from multiple POSIX threads (started in C code)?
Yes and yes. Though you have to register your threads with gcj. And
you might have to make sure that they are visible to the GC (by using
the GC's wrappers for the thread-creation functions).
Andy> Can I have multiple gcj interpreters active in the same
Andy> application?
It depends on what you mean.
Every thread can run its own java bytecode or native code.
However, all threads will see the same values for Java globals. For
instance, there is only one System.out.
Andy> I am asking, because implementing large applications
Andy> in C in the GNOME environment is painful :-(
Another option would be to use java-gnome and write your application
completely in java. In this case you'd be using gtk via java
wrappers, so your gtk knowledge from C would pretty much carry over.
If you're writing a large application you may also want to add
scripting via the bean scripting framework. I think both javascript
and jython can plug into this. These are available as part of rhug:
http://sources.redhat.com/rhug/
I'm pretty interested in helping people write GUI applications using
gcj. We still haven't found our "killer app".
Tom