This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Problem with -c and -shared in gcj
- To: java-discuss at sourceware dot cygnus dot com
- Subject: Problem with -c and -shared in gcj
- From: Matt Welsh <mdw at cs dot berkeley dot edu>
- Date: Tue, 15 Feb 2000 15:39:27 -0800
- Reply-To: Matt Welsh <mdw at cs dot berkeley dot edu>
Hi all,
Got the latest egcs and libgcj to test out automated dynamic class loading
from .so files. For some reason the .so's are not being found, however.
After a lot of gruntwork I narrowed it down to this: dlopen() (from
sys_dl_open() in libltdl) is getting the error
./JavaMicroBench.so: ELF file's phentsize not the expected size
(where JavaMicroBench.so is, obviously, the .so corresponding to the class
I'm trying to load.)
I produced this .so file with the command
gcj -c -shared -o JavaMicroBench.so JavaMicroBench.java
Just like Tom's recent e-mail showed:
http://sourceware.cygnus.com/ml/java-discuss/2000-q1/msg00213.html
Well, it turns out that using -c and -shared at the same time actually
produces a *static* object, not a *shared* one. In other words,
gcj -c -shared -o JavaMicroBench.so JavaMicroBench.java
Actually produces a normal ".o" file -- even though we used "-shared".
Probably just an option-parsing bug in gcj or egcs. ANYWAY, Jeff Sturm
pointed out correctly that -c and -shared shouldn't both work at the same
time. My guess is that Tom's example worked for him because he had a .class
or something else sitting around which was being found after the load of the
(badly formed) .so failed - am I right?
So dynamic class loading works fine if I do
gcj -shared -o JavaMicroBench.so JavaMicroBench.java
gij JavaMicroBench
It loads the .so file on demand and runs the class from there - bitchin'!
Matt Welsh