7 messages in net.java.dev.jna.users[jna-users] How to pass structure arr...
FromSent OnAttachments
schinApr 28, 2009 1:03 am 
schinApr 30, 2009 1:00 am 
Timothy WallApr 30, 2009 4:20 am 
schinApr 30, 2009 5:42 pm 
Timothy WallMay 1, 2009 4:07 am 
schinOct 8, 2009 9:47 pm 
schinOct 8, 2009 9:49 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] How to pass structure arrays in structure from java to c++Actions...
From:schin (sch@sdg.mdd.ricoh.co.jp)
Date:Apr 28, 2009 1:03:23 am
List:net.java.dev.jna.users

Please help me.

I want to pass a structure arrays in structure from java to c. Like as:

C++ typedef struct { int searchType; char* name; DETAIL1* detail1; int detail1Size; DETAIL2* detail2; int detail2Size; } SEARCHCONDITION;

typedef struct { char* name; int value; } DETAIL1;

typedef struct { char* name; char* value; } DETAIL2;

int search(SEARCHCONDITION* condition);

Java: public static class _SearchCondition extends Structure { public int searchType; public String name; public Pointer detail1; // Detail1 arrays public int detail1Size; public Pointer detail2; // Detail2 arrays public int detail2Size; }

public static class _Detail1 extends Structure { public String name; public int value; }

public static class _Detail2 extends Structure { public String name; public String value; }

int search(SearchCondition condition);

...

I create Detail1 arrays as

SearchCondition Condition = new SearchCondition(); ... Detail1[] detail1 = new Detail1[n]; ...

But I don't know how to change detail1(Detail1 arrays) to Pointer.

give some advise please. Thanks