2 messages in net.java.dev.jna.usersRe: [jna-users] help with stucture tr...
FromSent OnAttachments
Paul LoyJun 5, 2008 4:58 am 
evgeni shafranJun 5, 2008 5:57 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:Re: [jna-users] help with stucture transform.Actions...
From:evgeni shafran (yavj@gmail.com)
Date:Jun 5, 2008 5:57:32 am
List:net.java.dev.jna.users

thats what i thout, but when i use int it returnd the wrong data, are you sure it should be int?

On Thu, Jun 5, 2008 at 2:59 PM, Paul Loy <kete@gmail.com> wrote:

int

On Thu, Jun 5, 2008 at 12:58 PM, evgeni shafran <yavj@gmail.com> wrote:

i have a tructure in c that i need to transform into jna:

*

typedef **enum*

{

IDLE,

PREALARM,

ALARM,

ALERT,

TAPE

} State;

*

typedef **struct*

{

*int* size;

*bool* valid;

*bool* active;

*bool* signal;

State state;

*int* last_write_index;

*int* last_read_index;

time_t last_image_time;

*int* last_event;

*int* action;

*int* brightness;

*int* hue;

*int* colour;

*int* contrast;

*int* alarm_x;

*int* alarm_y;

*char* control_state[256];

} SharedData;

i tried to transform it and made:

import com.sun.jna.Pointer;

public class SharedData extends Structure { public int size; public boolean valid; public boolean active; public boolean signal; //public state; public int last_write_index; public int last_read_index; public long last_image_time; public int last_event; public int action; public int brightness; public int hue; public int colour; public int contrast; public int alarm_x; public int alarm_y; public byte[] control_state= new byte[256]; @Override protected void useMemory(Pointer m) { super.useMemory(m); super.read(); } @Override protected void useMemory(Pointer m, int offset) { super.useMemory(m, offset); }

}

i didnt find a way to transform enum into jna. to what transforms enum?