Compiling "static" applications with SWT/GTK

Andrew Haley aph@redhat.com
Wed Dec 3 10:28:00 GMT 2003


Bryce McKinlay writes:
 > On Dec 1, 2003, at 11:19 PM, Andrew Haley wrote:
 > 
 > > That's not really true, because of Java's Class.forName.  You have to
 > > include all of libgcj, because the linker can't tell what might be
 > > needed.
 > >
 > > As I have said here many times, the right thing to do is create a
 > > configure tool that splits libgcj into a number of components and
 > > allow the user to choose which ones they want.  But it's quite hard to
 > > solve the web of dependencies.
 > 
 > I think splitting libgcj up into many small peices would introduce more 
 > problems than it solves.

It would.  That is, of course, why I didn't suggest splitting libgcj
up into many small peices.

 > My idea for static applications is to have a runtime option that
 > dumps out a list of classes that are actually initialized/used by
 > the application, which is then fed back into the compiler (and
 > maybe combined with some static analysis) to generate an optimized
 > static executable that contains only the required bits of the
 > runtime.

Not a bad idea, but this seems very fragile.  How would anyone know
for sure which classes an application needed?  A few test runs
wouldn't do it.

Andrew.



More information about the Java mailing list