3 messages in net.java.dev.jna.users[jna-users] what is the JNA type for ...
FromSent OnAttachments
Roberto CavalcanteDec 17, 2008 2:41 pm 
Timothy WallDec 17, 2008 5:43 pm 
Roberto CavalcanteDec 17, 2008 10:33 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] what is the JNA type for "**short", "unsigned long" and enum?Actions...
From:Roberto Cavalcante (rmca@gmail.com)
Date:Dec 17, 2008 2:41:07 pm
List:net.java.dev.jna.users

Hi,

I have a C DLL witch I have to use. There is a function inside this DLL that requires a **short.

Header: typedef struct ZONING_RAWDATA { unsigned long triplet; /* Triplet for raw Data */ short **sheetXY; /* Array of Lenght colum and Width lines */ }ZONING_RAWDATA;

unsigned short ZONING_GetRawData(char * PlanName, ZONING_PLAN Plan, short NumberOfZone, short Triplet, ZONING_RAWDATA * Rawdata, double * Probability);

C code for using the function: RawData.sheetXY=(short **) malloc(50*sizeof(short*)); for (i=0;i<50;i++) { RawData.sheetXY[i]=(short *) malloc(100*sizeof(short)); }

_result = ZONING_GetRawData(PlanName,Plan,1,Triplet,&RawData, &Probability);

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

As you can see, I need a solution for representing "short **sheetXY" and for "unsigned long triplet" witch are inside the struct ZONING_RAWDATA. I know allocation is not a problem, I just want what type should I use for both struct elements and if the recommended type have some tricky code do get and set data, please, write this trick code too.

Now for the C enum, I have this enumeration: typedef enum Action { ADD_PLAN = 0, /* Add Plan */ MODIFY_PLAN = 1, /* Modification */ DELETE_PLAN = 2, /* Deletion */ ADD_ZONE = 3, /* Add Zone */ MODIFY_ZONE = 4, /* Modify or Delete Zone */ } Action;

How can I represent it?

I'm kind of desperate, so thanks a lot for any help you can provide.

Roberto M. Cavalcante