4 messages in net.java.dev.jna.usersRe: [jna-users] RE: Implementing Call...
FromSent OnAttachments
Richard OteroDec 17, 2007 12:02 pm.log
Timothy WallDec 17, 2007 12:37 pm 
Timothy WallDec 17, 2007 7:32 pm 
Richard OteroDec 20, 2007 6:34 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:Re: [jna-users] RE: Implementing Callback and problem with setting values for defineActions...
From:Timothy Wall (twal@dev.java.net)
Date:Dec 17, 2007 12:37:16 pm
List:net.java.dev.jna.users

I added a test for callback by value support (arg and return value) and it turns out it's not supported (oops). I'll take a look and see how long it'd take to put in.

On Dec 17, 2007, at 3:03 PM, Richard Otero wrote:

One other thing. If the structure is being passed by value, you need to use a ByValue version of your structure, e.g.

public static class MyStruct extends Structure { public static class ByValue extends MyStruct implements Structure.ByValue { } }

Thank you! I've used the above and the example on the site to modify the code to pass the struct by value. It though is still showing similar behavior.

The values are still not passed but at least there is now a message from the JRE with a bit more info. I've attached the log file.

I've upgraded to the latest version of jna.jar within the subversion repository.

Thank you for your help on this!

Richard

----------------------------------------------------------------------

----------

Check the structure address (getPointer()) when passed to the GTS library and when it is received by the callback. Is it the same address?

Dump the structure at both points to see the memory layout (toString ()). Does it match what an equivalent C program sees?

I printed the hex for the address of the struct in the C code (&grid) and it was different from the value I printed when using getPointer.

If there is any more information that might be helpful to you; please let me know!

Within Main function: gridPointer='Native Allocated Memory <0xaf94360> (64 bytes)' Within Main function: toString()='ssdl.aeromesh.GTSLibrary$GtsCartesianGrid$ByValue(Native Allocated Memory <0xaf94360> (64 bytes)) int nx@0=100 int ny@4=100 int nz@8=100 double x@10=0.0 double dx@18=0.01 double y@20=0.0 double dy@28=0.01 double z@30=0.0 double dz@38=0.01 memory dump [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000] [00000000]' # # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77c4709c, pid=160, tid=2948 # # Java VM: Java HotSpot(TM) Client VM (1.6.0_03-b05 mixed mode) # Problematic frame: # C [msvcrt.dll+0x3709c] # # An error report file with more information is saved as hs_err_pid160.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Within C code for gts_isosurface_cartesian: gridPointer='90d9b4' Within C code for gts_isosurface_cartesian: g.nx='0.000000' g.ny='0.000000' g.nz='0.000000'<hs_err_pid160.log>------------------------------------