2 messages in net.java.dev.jna.usersPointer to double array in callback f...
FromSent OnAttachments
Louis HemonSep 28, 2007 12:29 pm.cpp, .h, .java, 1 more
Timothy WallSep 28, 2007 1:21 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Pointer to double array in callback function (crash JVM)Actions...
From:Louis Hemon (Loui@gmail.com)
Date:Sep 28, 2007 12:29:03 pm
List:net.java.dev.jna.users
Attachments:

Hello,

I have a problem with this code (attachement).

C callback : typedef void (*MYFUNCTION)(int n, int *x);

in java : public interface MYFUNCTION extends Callback { void callback(int n, Pointer x); }

This function is implemented as follow in other class :

class Myfunction implements Testlib.MYFUNCTION { public Myfunction(Testlib testlib) { this.testlib = testlib; }

@Override public void callback(int n, Pointer x) { System.out.println("Myfunction"); int doublesize = testlib.getDoubleSize(); System.out.println("doublesize : " + doublesize);

for (int i = 0; i < n; i++) x.setDouble(doublesize * i, i);

System.out.println("End Myfunction"); }

Testlib testlib; }

When I execute this code the JVM crash. I don t understand why?

Thanks,