[kaffe] Re: ARM: unable to load .class files - Help required
Quaritsch Markus
quam at qwws.net
Tue Oct 12 01:59:14 PDT 2004
Hi,
I'm a colleague of Winkler Thomas.
Dalibor Topic wrote 'Re: ARM: unable to load .class files - Help required':
> The File code has changed quite a bit in CVS, it's merged with GNU
> Classpath now. Could you give it a spin and see if that works better for
> you?
We will give it a try.
But I don't think the Problem is related to the File code. I've written a
simple Java program which calls a C function and this also does not work
as expected on the xscale.
Here is the simple Java program:
,----[ CTest.java ]
| public class CTest {
|
| static { System.loadLibrary("c_function") }
|
| public native int returnInt();
|
| public native long returnLong();
|
| public static void main(String[] args)
| {
| CTest me = new CTest();
| System.out.println("Trying to call c-function...");
|
| System.out.println("int: " + me.returnInt());
| System.out.println("long: " + me.returnLong());
| }
| }
`----
and this is the corresponding C-file:
,----[ cfunction.c ]
| #include "CTest.h"
|
| jint Java_CTest_returnInt(JNIEnv *foo, jobject bar) {
| return 1234;
| }
|
| jlong Java_CTest_returnLong(JNIEnv *foo, jobject bar) {
| return 4321l;
| }
`----
where CTest.h was generated with javah.
When running on a x86 machine or a powerbook G4 I get the expected
values, but on the xscale the output is as follows:
,----
| root at IXDP425:/mnt/quaritsch# java -cp CTest.jar CTest
| Trying to call c-function...
| int: 1234
| long: 1074450732
`----
So I asume that there might be something wrong related to JNI. But
I didn't manage to find the correct place to start debugging the jni.
Could you please provide me some guidance where to start? Which jni
functions are involved when doing the call shown above?
lg
quaritsch markus
--
| .''`. | Quaritsch Markus quam at qwws.net Student of Telematics |
| : :' : | TU-Graz, Austria |
| `. `' | |
| `- | Calculating in binary code is as easy as 01,10,11. |
More information about the kaffe
mailing list