This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

BUG REPORT: Loading dynamically native shared-libs ends up withcast error. (Interpreter-mode works!)


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)

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





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