2 messages in net.java.dev.jna.users[jna-users] array in a Structure
FromSent OnAttachments
amina guermoucheSep 9, 2008 2:09 am 
Timothy WallSep 9, 2008 6:16 am 
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] array in a StructureActions...
From:amina guermouche (guer@yahoo.fr)
Date:Sep 9, 2008 2:09:42 am
List:net.java.dev.jna.users

Hello,

I have this structure in C:

struct cell_t { struct coord_z3_t id; /**< cell coordinates in the mesh */ unsigned int point[8]; /**< array of indexed points defined */ struct cell_list_t *neighbour_list[6]; /**< cell's neighbourhood */ struct cell_info_t *cell_info; /**< score information summary */

};

I've translated it in java this way: public class cell_t extends Structure{ public coord_z3_t id; public int point[]=new int[8]; public cell_list_t []neighbour_list[]; public cell_info_t cell_info[]; }

THe problem I have is that in C, all the fields of the structure are initialized
later (especially the arrays), but in java, if I don't initialize the arrays,
the program doesn't work because I have to initialize them. I don't know the
size here, so I've just tried to put the size at 1, but that causes a stack
overflow error. Can anyone help me please. Thanks.