Hello,
I'm exploiting JNA callback features and in my C library I have the
following declarations:
/*data list definition*/
typedef struct _tagMyDataList
{
char chExchangeCode;
char szExchangeName[61];
struct _tagMyDataList* pcNext;
} MyDataList;
/*callback function definition*/
typedef void (*OnDataExchanges) (int nNumExchanges, const MyDataList*
pcMyDataList);
In Java the mapping I'm doing is
public class MyDataList extends Structure {
public char chExchangeCode;
public String szExchangeName;
public MyDataList pcNext;
}
public interface OnDataExchanges extends Callback
{
void callback(int count, Pointer list);
}
My question is: is it right to declare the callback function with
Pointer type instead of MyDataList type?
I'd like and tried the second way but at runtime on the java side,
invoking the callback function from C library and
passing some dinamically created MyDataList objects, I get Pointer
objects. How can I obtain
Structure objects (MyDataList) from Pointer object?
thanks,
Vito