public final class AddressByReference extends AbstractReference<Address>
For example, the following C code,
extern void get_a(void** ap);
void* foo(void) {
void* 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 AddressByReference ap);
}
and used like this
AddressByReference ap = new AddressByReference();
lib.get_a(ap);
System.out.println("a from lib=" + a.getValue());
Constructor and Description |
---|
AddressByReference()
Creates a new reference to an integer value
|
AddressByReference(Address value)
Creates a new reference to an address value
|
Modifier and Type | Method and Description |
---|---|
void |
fromNative(Runtime runtime,
Pointer memory,
long offset)
Copies the address value from native memory
|
int |
nativeSize(Runtime runtime)
Gets the native size of type of reference
|
void |
toNative(Runtime runtime,
Pointer memory,
long offset)
Copies the address value to native memory
|
checkNull, getValue
public AddressByReference()
public AddressByReference(Address value)
value
- the initial native valuepublic void toNative(Runtime runtime, Pointer memory, long offset)
runtime
- The current runtime.memory
- The native memory bufferoffset
- The offset.public void fromNative(Runtime runtime, Pointer memory, long offset)
runtime
- The current runtime.memory
- The native memory buffer.offset
- The offset.public int nativeSize(Runtime runtime)
runtime
- The current runtime.Copyright © 2017. All rights reserved.