BUG REPORT. Loading native-libs dynamically end up with cast-error...

Clemens Eisserer Linuxhippy@web.de
Mon Nov 25 23:00:00 GMT 2002


HI 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)
I dont know waht -fPIC does, but with it, the program crashes....
You can easly see 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 a 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!
I hope you can fix it easily, good luck!!!
Mfg Linuxhippy
______________________________________________________________________________
Erster Klick - SMS versenden, zweiter Klick - die Telefonnummer im 
Adressbuch speichern bei: http://freemail.web.de/features/?mc=021151


More information about the Java mailing list

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