GCJ: Trouble with static initialization

Craig A. Vanderborgh craigv@voxware.com
Tue Jul 15 00:38:00 GMT 2003


Hello everyone:

We need some guidance from the experts.  We are working on porting a
large Java application to GCJ.  We have encountered an "infant death"
problem where our application crashes in startup, due (apparently) to
attempts to access uninitialized static class members that should
already have been initialized.

The weird thing about it is the failure is stochastic - about half the
time the program runs to completion, the other half it fails in
startup.  The target system we are developing on is an embedded system
so we don't have a lot of information about *where*, exactly, it is
failing.  We are working on that...

What I would like to ask is this - does GCJ have the same
cross-translation-unit initialization rules that C++ does?  That is, 
does GCJ "get static initialization done somehow" when the
initialization of an object in translation unit A depends on the value
of another object in a different translation unit, and that second
object itself requires initialization?

Please advise.
TIA,
craig vanderborgh
voxware incorporated




More information about the Java mailing list