Hi
Currently doing my very first steps between the worlds of C and Java.
I got a header file that features structs and function calls of a specific
dll I would like to access from within Java. Due to my lacking knowledge
of C I decided to use JNA for integration purposes.
The standard calls work by now, I even managed to figure out the special
way that strings get treaten in C. But now I am stuck on this call and its
corresponding struct:
FFACE_API INVENTORYITEM GetInventoryItem(int index, DWORD PID = 0);
struct INVENTORYITEM
{
short id;
unsigned char index;
unsigned char count;
};
My java mapping looks like this:
public interface FFaceApix extends Library {
FFaceApix INSTANCE = (FFaceApix)
Native.loadLibrary("FFACE", FFaceApix.class);
INVENTORYITEM GetInventoryItem(int index, int PID);
}
public static class INVENTORYITEM extends com.sun.jna.Structure {
public short id;
public byte index;
public byte count;
}
When accessing the mapped function I get an 'EXCEPTION_ACCESS_VIOLATION'.
After having read lots of posts and checking out the JNA api aswell as the
other documentation I still can't manage to make this work.
What did I not take care of with my mapping?
Regards,
Armin