For example, the following C code,
extern void get_a(int * ap);
int foo(void) {
int a;
// pass a reference to 'a' so get_a() can fill it out
get_a(&a);
return a;
}
Would be declared in java as
interface Lib {
void get_a(@Out IntByReference ap);
}
and used like this
IntByReference ap = new IntByReference();
lib.get_a(ap);
System.out.printf("a from lib=%d\n", a.getValue());
| Modifier and Type | Method and Description |
|---|---|
| public void | fromNative(Runtime
The current runtime. runtime, Pointer the native memory buffer. memory, long The offset of the field. offset)Copies the java value from native memory |
| public T | |
| public int | Returns: the size in bytes of the native typeThe current runtime. runtime)Gets the size of the native buffer required to store the value |
| public void |
| fromNative | back to summary |
|---|---|
| public void fromNative(Runtime runtime, Pointer memory, long offset) Copies the java value from native memory | |
| getValue | back to summary |
|---|---|
| public T getValue() | |
| nativeSize | back to summary |
|---|---|
| public int nativeSize(Runtime runtime) Gets the size of the native buffer required to store the value
| |
| toNative | back to summary |
|---|---|
| public void toNative(Runtime runtime, Pointer memory, long offset) Copies the java value to native memory | |