KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How can I call a method with this method signature in C from JNA? int open_device(context *ctx, device **dev, int index); The last two lines of the C method look like this: *dev = pdev; return 0; That's the only use of dev in that method. That means that I have to pass a poiner to an empty pointer to the method, right? The method then fills the empty pointer with the address of a device object and I can pass the pointer to the device to other methods. My question is: Is this the right way to do that? If it is, how do I allocate a new pointer from Java? Based on the accepted answer, I did this: Memory p = new Memory(Pointer.SIZE); Memory p2 = new Memory(Pointer.SIZE); p.setPointer(0, p2); nativeLib.open_device(ctx, p, index); return p2;
Tags (comma-separated)
Save Edits
Cancel