

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.java.dev.jna.usersRe: [jna-users] FW: Invalid memory ac...| From | Sent On | Attachments |
|---|---|---|
| Daniel Thornhill | Dec 12, 2008 7:57 am | |
| Timothy Wall | Dec 12, 2008 4:27 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] FW: Invalid memory access | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Dec 12, 2008 4:27:30 pm | |
| List: | net.java.dev.jna.users | |
PVOID is Pointer, not PointerByReference, although that won't make any difference if you don't access the arguments.
If the error is happening after the callback returns, then your calling convention may be incorrect, or your arguments incorrectly mapped on either the called function or the callback.
On Dec 12, 2008, at 10:58 AM, Daniel Thornhill wrote:
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.
The information in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee(s). Access to this e-mail by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing ValidSoft client terms and conditions.







