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 line
Even better answer. You may want to allocate (malloc etc) depending upon Java String length. Example below is unit test from JNA project.
public void testGetSetStringWithDefaultEncoding() throws Exception {
final String ENCODING = Native.DEFAULT_ENCODING;
String VALUE = getName();
int size = VALUE.getBytes(ENCODING).length+1;
Memory m = new Memory(size);
m.setString(0, VALUE);
assertEquals("Wrong decoded value", VALUE, m.getString(0));
}