SV: Pruning libgcj

Øyvind Harboe oyvind.harboe@zylin.com
Thu Feb 27 16:32:00 GMT 2003


> > How can GCJ not to link with libgcj?
> >
> > I was toying with the idea of using something like jclassinfo from sourceforge to list all the
> > class files required starting at --main and then compiling only those. I'm expecting that
> > this should discover almost all the classes required for the build.
>>It won't.
>>The linker already only links in classes for which there is a direct
>reference in your program or libgcj startup. If you use the command
>-Wl,-Map,myprog.map command while building your program you'll see how
>this works.

Ah. I see. I could use this trick for my app. I have serveral large .jars
for which I only use a subset for the native parts, currently the entire .jars
are linked into the executable.
Here is a demonstration of size savings when applied to Mohans HelloSWT
gcj -s -o HelloSWT.exe -fjni --main=HelloSWT swt_noawt.jar HelloSWT.java
->
helloswt.exe 3,5MB
\thisiscool-gcc\gcc-3.3\bin\gcj -s -o HelloSWT2.exe -fjni --main=HelloSWT --classpath=swt.jar HelloSWT.java -lswt
helloswt.exe 2,7MB
Øyvind


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /