2 messages in net.java.dev.jna.users[jna-users] FW: Invalid memory access
FromSent OnAttachments
Daniel ThornhillDec 12, 2008 7:57 am 
Timothy WallDec 12, 2008 4:27 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:[jna-users] FW: Invalid memory accessActions...
From:Daniel Thornhill (Dani@validsoft.com)
Date:Dec 12, 2008 7:57:48 am
List:net.java.dev.jna.users

Hi all, Wondering if you could help me. I am trying to implement a call back function
for my c/c++. The call back function is call but then I get the error,

Exception in thread "main" java.lang.Error: Invalid memory access at com.sun.jna.Function.invokeInt(Native Method) at com.sun.jna.Function.invoke(Function.java:298) at com.sun.jna.Function.invoke(Function.java:223) at com.sun.jna.Library$Handler.invoke(Library.java:204) at $Proxy0.DivaDial(Unknown Source) at
com.validsoft.tools.telephony.eicondiva.jna.test.Test.main(Test.java:29)

The C function I am trying to connect to has the signature,

static void CallbackHandler ( DivaAppHandle hApp, DivaEvent
Event, PVOID Param1, PVOID Param2 )

and the Java I have written is,

public interface DivaCallbackHandler extends Callback { public void callback( Pointer hApp, int Event, PointerByReference param1, PointerByReference
param2 ); }

and...

public class CallbackHandler implements DivaCallbackHandler {

public void callback(Pointer hApp, int event, PointerByReference param1, PointerByReference param2) { System.out.println("CallbackHandler.CallbackHandler():: I have
been called back!!"); }

}

I get the System.out line written to the console, and the it fails - and ideas?
I have tried using IntByReference for PVOID parameters as well.

Thanks in advance, Daniel

ValidSoft Ltd is a Private Limited Company. ValidSoft Ltd, Castle Buildings, Tara Street, Tullamore, Co Offaly, Ireland. Registration Number: 377068 Registered in Dublin.