17 messages in net.java.dev.jna.usersRe: [jna-users] Array of Structures i...
FromSent OnAttachments
RWAD...@UP.COMJul 18, 2008 8:39 am 
Timothy WallJul 18, 2008 9:26 am 
RWAD...@UP.COMJul 18, 2008 9:46 am 
Timothy WallJul 18, 2008 10:18 am 
RWAD...@UP.COMJul 18, 2008 11:07 am 
RWAD...@UP.COMJul 18, 2008 11:19 am 
Timothy WallJul 18, 2008 11:35 am 
Timothy WallJul 18, 2008 11:40 am 
Timothy WallJul 18, 2008 11:44 am 
Timothy WallJul 18, 2008 11:46 am 
RWAD...@UP.COMJul 18, 2008 12:01 pm 
RWAD...@UP.COMJul 18, 2008 12:07 pm 
RWAD...@UP.COMJul 18, 2008 12:09 pm 
RWAD...@UP.COMJul 18, 2008 12:28 pm 
Timothy WallJul 18, 2008 12:46 pm 
RWAD...@UP.COMJul 18, 2008 12:55 pm 
RWAD...@UP.COMJul 18, 2008 1:16 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] Array of Structures in a StructureActions...
From:RWAD...@UP.COM (RWAD@UP.COM)
Date:Jul 18, 2008 12:07:09 pm
List:net.java.dev.jna.users

Don't know if this is significant, but here's the actual C code for the function definition:

void efm111_det_enty_rop_at_loca(Fac_Type_Struct fac_type, SYSNBR in_rl_nbr, Propo_Struct in_propo[3], short int *sop_count, Op_And_Ornt_Struct sop[MAX_SOPS_AT_RL])

And here's the Java declaration in our interface:

void efm111_det_enty_rop_at_loca(FacilityTypeStructure fac_type, int in_rl_nbr, PropoStructure in_propo[], ShortByReference sop_count, ObjectPointAndOrientationStructure sop[]);

And here's the call we make from Java:

Efms.API.INSTANCE.efm111_det_enty_rop_at_loca(type, nlNumber, propos, sopCount, opos);

_______________________________

Hardware /nm./: the part of the computer you can kick.

RWAD@UP.COM 07/18/2008 02:01 PM Please respond to use@jna.dev.java.net

To use@jna.dev.java.net cc

Subject Re: [jna-users] Array of Structures in a Structure

I removed most of the forwarded thread to simplify this. Here's the latest output.

ObjectPointAndOrientationStructure(allocated@0x376ae8 (592 bytes) (shared from allocated@0x376ae8 (592 bytes))) { ObjectPointStructure obj_pnt@0=ObjectPointStructure(allocated@0x32227e0 (24 bytes)) { int obj_pnt_nbr@0=0 int fac_type_sys_nbr@4=0 int fac_enty_nbr@8=0 int rail_loca_nbr@c=0 byte obj_pnt_type_code[5]@10=[B@1a897a9 } int num_rpls@18=0 OrientationStructure ornt[3]@20=[Lcom.uprr.efm.nativ.struct.OrientationStructure;@17cec96 } ObjectPointAndOrientationStructure(allocated@0x376c10 (296 bytes) (shared from allocated@0x376c10 (296 bytes) (shared from allocated@0x376ae8 (592 bytes) (shared from allocated@0x376ae8 (592 bytes))))) { ObjectPointStructure obj_pnt@0=ObjectPointStructure(allocated@0x376c10 (296 bytes) (shared from allocated@0x376c10 (296 bytes) (shared from allocated@0x376c10 (296 bytes) (shared from allocated@0x376ae8 (592 bytes) (shared from allocated@0x376ae8 (592 bytes)))))) { int obj_pnt_nbr@0=0 int fac_type_sys_nbr@4=0 int fac_enty_nbr@8=0 int rail_loca_nbr@c=0 byte obj_pnt_type_code[5]@10=[B@90832e } int num_rpls@18=0 OrientationStructure ornt[3]@20=[Lcom.uprr.efm.nativ.struct.OrientationStructure;@1947496 } # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x03cdebf1, pid=5552, tid=5656 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode, sharing) # Problematic frame: # C [efms-api.dll+0x2ebf1] # # An error report file with more information is saved as hs_err_pid5552.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # Connected to dev091 as dtns999 Entered efm111 PROPO array pointer was NOT null. Building log entry About to write log entry Wrote log entry Building log entry with PROPO data About to write PROPO data to log Wrote PROPO data to log Sizeof(Op_And_Ornt_Struct) = 296 bytes About to initialize SOP output array: 592 bytes starting at 1000E5A4.

The output above is generated by this code:

ObjectPointAndOrientationStructure opo = new ObjectPointAndOrientationStructure(); final ObjectPointAndOrientationStructure[] opos = (ObjectPointAndOrientationStructure[])opo.toArray(2); for (ObjectPointAndOrientationStructure entry : opos) { System.err.println(entry.toString()); }

Am not sure how to interpret the addresses in the output. I do note that the pointer output from the C program ("About to initalize SOP output...", 1000E5A4) seems to be significantly different from the addreses mentioned in the Structure.toString() output. However, these might be virtual rather than physical addresses, so I don't know if that matters. The pointer mentioned in the HotSpot error mesage (03cdebf1) seems to be beyond the range mentioned in the toString() output.