configuring gcj

Tom Tromey tromey@cygnus.com
Thu Oct 7 20:11:00 GMT 1999


>>>>> ">" == Weiqi Gao <weiqigao@a.crl.com> writes:

>> 1.  How should one configure threads support?

The libgcj docs are correct, the gcc docs are wrong.
Please submit a gcc bug report.

>> I guess my current configuration is the default ``none'' threads.
>> Does that mean my Java Threads are not mapped to system threads
>> (like the green_threads from Sun)?

"none" means that you have no threads at all.  If you try to run a
multi-threaded Java program, it will abort.

>> Had I configured with ``posix'' threads, would my Java Threads then
>> map to system threads?

Yes.

>> How should the -D_REENTRANT #define be used when compiling CNI
>> native methods?  (In either the ``none'' or the ``posix''
>> configuration.)

It probably only matters if you call thread functions directly, which
you shouldn't.

>> 2.  CNI is only for writing native methods, right?

That is its primary purpose.

>> Browsing through the maillist archive, I get the implression that
>> CNI is for writing native methods for Java classes only.  Doing
>> something like

>> int main()
>> {
>>   java::lang::System::out->println();
>> }

>> will only cause segmentation faults.  Did I read it right?  If I
>> am, is this by design or by accident?  Can/will this be made to
>> work in the future?

The Java runtime is not fully self-initializing.  If you really want
your own main() then it should follow along the lines of the JvRunMain
function.  However, I recommend against doing this.

We might support this someday, but there are no plans.  Proposals and
patches will be considered, of course :-)

Tom


More information about the Java mailing list