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.intValue());
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | fromNative(Runtime
the current runtime. runtime, Pointer the native memory buffer. buffer, long the memory offset. offset)Implements jnr. |
| public int | Returns: Integer.SIZEThe current runtime. runtime)Implements jnr. |
| public void | toNative(Runtime
the current runtime. runtime, Pointer the native memory buffer. buffer, long the memory offset. offset)Implements jnr. |
| IntByReference | back to summary |
|---|---|
| public IntByReference() Creates a new reference to an integer value initialized to zero. | |
| IntByReference | back to summary |
|---|---|
| public IntByReference(Integer value) Creates a new reference to an integer value
| |
| IntByReference | back to summary |
|---|---|
| public IntByReference(int value) Creates a new reference to an integer value
| |
| fromNative | back to summary |
|---|---|
| public void fromNative(Runtime runtime, Pointer buffer, long offset) Implements jnr. Copies the integer value from native memory | |
| nativeSize | back to summary |
|---|---|
| public int nativeSize(Runtime runtime) Implements jnr. Gets the native size of type of reference
| |
| toNative | back to summary |
|---|---|
| public void toNative(Runtime runtime, Pointer buffer, long offset) Implements jnr. Copies the integer value to native memory | |