For example, the following C code,
extern void get_size(ssize_t *sp);
ssize_t foo(void) {
ssize_t n;
// pass a reference to 'n' so get_size() can fill it out
get_size(&n);
return n;
}
Would be declared in java as
interface Lib {
void get_size(@Out NumberByReference ap);
}
and used like this
NumberByReference size = new NumberByReference(ssize_t);
lib.get_size(size);
System.out.printf("size from lib=%d\n", size.longValue());
| Modifier and Type | Field and Description |
|---|---|
| private final TypeAlias |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| 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)Implements jnr. |
| public int | nativeSize(Runtime
The current runtime. runtime)Implements jnr. |
| public void | toNative(Runtime
The current runtime. runtime, Pointer The native memory buffer. memory, long The offset of the field. offset)Implements jnr. |
| typeAlias | back to summary |
|---|---|
| private final TypeAlias typeAlias | |
| NumberByReference | back to summary |
|---|---|
| public NumberByReference(TypeAlias typeAlias, Number value) | |
| NumberByReference | back to summary |
|---|---|
| public NumberByReference(TypeAlias typeAlias) | |
| fromNative | back to summary |
|---|---|
| public void fromNative(Runtime runtime, Pointer memory, long offset) Implements jnr. Doc from jnr. Copies the java value from native memory | |
| nativeSize | back to summary |
|---|---|
| public int nativeSize(Runtime runtime) Implements jnr. Doc from jnr. 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) Implements jnr. Doc from jnr. Copies the java value to native memory | |