"reference to struct pointer" => not exactly common terminology in C, but "struct **" is my best guess
struct pointer => "struct *"
I'm guessing you want "struct *" and not "struct **".
struct * => Structure (when used as a function parameter) this is sufficient for the native call to be able to populate the struct
As for calling the function pointers, see the JNA doc sections on callbacks/function pointers.
> Hi Timothy,
>
> Yes, sorry for the missing data, here you go:
>
> // native code
> struct {
> } struct_interface;
hm... how about "provide the native declaration of the function you are trying to map"?
> Hi Timothy,
>
> Yes, sorry for the missing data. And I accidentally posted my reply
> before typing it in completely, so here you go:
>
> // native code
> struct {
> int (*uninit) (struct_interface *this, int param);
> int attr;
> } struct_interface
>
> int populateInterface(struct_interface **intf);
>
> // use it
>
> struct_interface *ret_struct = null;
> populateInterface(&ret_struct);
>
> ret_struct->uninit(ret_struct, 0);
In this case, you need to obtain the address of the structure from the native code (use PointerByReference as the argument type, and PointerByReference.getValue() to get the pointer after the call). You can then use that address to initialize your custom Structure instance, e.g.
public class MyStructure extends Structure {
public MyCallbackType uninit;
public int attr;
// ...
public MyStructure(Pointer p) {
super(p);
read();
}
// ...