Problem with -c and -shared in gcj

Matt Welsh mdw@cs.berkeley.edu
Sat Apr 1 00:00:00 GMT 2000


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


More information about the Java mailing list

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