coolness

Anthony Green green@cygnus.com
Thu Mar 4 11:31:00 GMT 1999


Jeff Sturm wrote:
> I would think an explicit call to foo::bar should be resolved at link
> time, or fail with an unresolved symbol.

That's right.

> What needs to work in gcj is Class.forName("...") which is scattered
> all over in most java code, including the Sun java.* classes, and
> most JDBC programs (consider how JDBC drivers are loaded
> dynamically).

Yes, this is an important feature.  For Class.forName to work right
now, you have to link every needed class into the final image.  This
is relatively straight forward to do with the GNU linker flag `-u'.

For instance, if you used Class.forName("gnu.gcj.test") in your code,
you might build your application like this:

gcj -o foo --main=foo foo.java -Wl,-u,_CL_Q33gnu3gcj4test

...where _CL_Q33gnu3gcj4test is the mangled symbol for gnu.gcj.test.

Hmmm, it seems like a more convenient compiler flag might be useful.

You are right though - dynamically locating and linking the compiled
code is the right way to go for many applications.

AG

-- 
Anthony Green                                               Cygnus Solutions
                                                       Sunnyvale, California


More information about the Java mailing list