This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: SWT in a DLL [long]
Andrew Haley wrote:
To the best of my knowledge it's not required by gcj either.
If I were you I'd compile each jar file on its own and then link the
resulting objects together.
Thank you for the suggestion, it works!
I've used the following commands:
gcj -c -fjni -findirect-dispatch org.eclipse.osgi_3.1.1.jar -o
org.eclipse.osgi_3.1.1.o
gcj -c -fjni -findirect-dispatch org.eclipse.core.runtime_3.1.1.jar -o
org.eclipse.core.runtime_3.1.1.o
gcj -c -fjni -findirect-dispatch org.eclipse.core.commands_3.1.0.jar -o
org.eclipse.core.commands_3.1.0.o
gcj -c -fjni -findirect-dispatch org.eclipse.core.expressions_3.1.0.jar
-o org.eclipse.core.expressions_3.1.0.o
gcj -c -fjni -findirect-dispatch swt.jar -o swt.o
gcj -c -fjni -findirect-dispatch org.eclipse.jface_3.1.1.jar -o
org.eclipse.jface_3.1.1.o
gcj -c -fjni -findirect-dispatch explorer.jar -o explorer.o
--main=explorer_12.Explorer
gcj -findirect-dispatch -fjni *.o --main=explorer_12.Explorer -o explorer
And now the jface file explorer works as expected :-)
(Also, it's obviously better for development).
I'm wondering about the size: it's an executable of 29 MB, ouch!
Stripping it turns it down to 16MB, but:
* it's still very large (to be fair, an equivalent pure java application
needs the jre, which is over 70MB)
* I'm wondering if stripped it's still able to generate stack traces...
I've tried compressing it with upx, goes down to 5MB, but memory
consumption at startup grows in this case. Anyone knows why?
In the meantime I've spotted another ordering problem in my previous
command line, the core runtime library needs osgi to work.
With the jar properly ordered my previous command line generates
the binary, and it works too.
So, there are definitely ordering issues. For the record, the
working command line is:
gcj -fjni -findirect-dispatch org.eclipse.osgi_3.1.1.jar
org.eclipse.core.runtime_3.1.1_.jar org.eclipse.core.commands_3.1.0.jar
org.eclipse.core.expressions_3.1.0.jar swt.jar
org.eclipse.jface_3.1.1.jar explorer.jar --main=explorer_12.Explorer -o
explorer
Best regards
Andrea Aime