public interface ByReference<T>
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 |
---|---|
void |
fromNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value from native memory
|
T |
getValue() |
int |
nativeSize(Runtime runtime)
Gets the size of the native buffer required to store the value
|
void |
toNative(Runtime runtime,
Pointer memory,
long offset)
Copies the java value to native memory
|
int nativeSize(Runtime runtime)
runtime
- The current runtime.void toNative(Runtime runtime, Pointer memory, long offset)
runtime
- The current runtime.memory
- The native memory buffer.offset
- The offset of the field.void fromNative(Runtime runtime, Pointer memory, long offset)
runtime
- The current runtime.memory
- the native memory buffer.offset
- The offset of the field.T getValue()
Copyright © 2017. All rights reserved.