public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Problem with -c and -shared in gcj
  2000-04-01  0:00 Problem with -c and -shared in gcj Matt Welsh
@ 2000-04-01  0:00 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Matt Welsh; +Cc: java-discuss

Matt> Probably just an option-parsing bug in gcj or egcs.

Could you send a gcc bug report?
It would be nice to get this fixed.

Matt> My guess is that Tom's example worked for him because he had a
Matt> .class or something else sitting around which was being found
Matt> after the load of the (badly formed) .so failed - am I right?

It's possible.  I don't remember.  Or maybe it is some
system-dependent thing.  What platform are you on?

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Problem with -c and -shared in gcj
@ 2000-04-01  0:00 Matt Welsh
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Welsh @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 Problem with -c and -shared in gcj Matt Welsh
2000-04-01  0:00 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).