This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[ATTACHEMENT TO:] BUG REPORT. Loading native-libs dynamically end up with cast-error...


HI there!

1.) Sorry for forgetting the attachement. It seems that I´m even more buggy then gcj ;-)

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
______________________________________________________________________________
ASCII-Bilder und SMS-Sprüche bei WEB.DE FreeMail - auswählen, einfügen
und versenden! http://freemail.web.de/features/?mc=021168

Attachment: gcj-dynamic-error.tar.gz
Description: application/gunzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]