BUG REPORT (with source-attachment!): Loading dynamically native shared-libs ends up with cast error. (Interpreter-mode works!)

Linuxhippy linuxhippy@web.de
Mon Nov 25 14:15:00 GMT 2002


HI there!


1.) Sorry, in the last mail I forgot to attach the source. *sorry*
Now its there

I´ve tinkered several times on this problem, but I think its a bug.

There are two small classes and one interface, using dynamically-class
loading.
My Problem is, that with the interpreted .class-file (interpreted by
libgcj) everything works fine, but if I compile the dynamically-class
with gcj to native-code, it says to me, that
"java.lang.ClassCastException: bte cannot be cast to bi". Class bte is
the dynamic-class, bi ist the interface.

I really dont understand this error, I compiled the two parts (loader
and dynamically loaded lib) like this:

1.)  gcj  Loader.java bi.java -o tes --main=Loader  //The
main-executable (Loader)

2.)  gcj -shared bte.java bi.java -o lib-bte.so  //The dynamically
loaded Class (Plus the interface, otherwise the classloader is not happy)

You can easly try the error: All you need is a libgcj-3.2 and the files
I´ve attached. run first tes, and you´ll get the cast-error, after that
remove or rename lib-bte.so, so that libgcj is forced to interpret the
class-file and it will work.

So if you want to inspect my code, simply untar the archive.
e.g. This is only a concept-progam. I realized that"bug" in  much bigger
app, which would be hard to understand for not involved people. So I
wrote this small program...

I´ve tried to get along with gdb, but I´ve never used this tool and it
seems quite complicated to me *newbie*...

I´m sorry that I cannot fix  this bug by myself, because I´m not a good
coder and I dont understand anything about libgcj. But I promise to post
a big thanks to the gcj-team in my (mainstream)-GPLed program!

Mfg Linuxhippy





-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcj-dynamic-error.tar.gz
Type: application/x-gunzip
Size: 20124 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20021125/cc54dd25/attachment.bin>


More information about the Gcc-bugs mailing list