# FixNative Documentation

Back to summary

`import "native/native";`

## Pointer class

Pointer to arbitrary memory location.

Subclasses: Memory

### Initialization

`static function create(lo: Integer, hi: Integer): Pointer`
  Creates a new pointer with given address.
`static function from_shared_array(shared_array): Pointer`
  Creates a new pointer with address used by the shared array.

### Manipulation

`function get_value(): Integer, Integer`
  Returns the address of this pointer as two results (low and high part).
`function with_offset(offset: Integer): Pointer`
  Returns a new pointer with given offset.
`function get_view(off: Integer, len: Integer, elem_size: Integer): Integer[]`
  Creates a view into memory as a shared array.

### Memory access

`function set_byte(offset: Integer, value: Integer)
function set_short(offset: Integer, value: Integer)
function set_int(offset: Integer, value: Integer)
function set_long(offset: Integer, value_lo: Integer, value_hi: Integer)
function set_nlong(offset: Integer, value_lo: Integer, value_hi: Integer)
function set_float(offset: Integer, value: Float)
function set_double(offset: Integer, value_lo: Integer, value_hi: Integer)
function set_pointer(offset: Integer, value: Pointer)
`
  Sets memory location to given value. Offset is in bytes.
`function get_byte(offset: Integer): Integer
function get_short(offset: Integer): Integer
function get_int(offset: Integer): Integer
function get_long(offset: Integer): Integer, Integer
function get_nlong(offset: Integer): Integer, Integer
function get_float(offset: Integer): Float
function get_double(offset: Integer): Integer, Integer
function get_pointer(offset: Integer): Pointer
`
  Gets value from memory location. Offset is in bytes.
`function set_bytes(offset: Integer, arr: Byte[])
function set_bytes(offset: Integer, arr: Byte[], off: Integer, len: Integer)
`
  Copies bytes from given array to given memory location.
`function get_bytes(offset: Integer, arr: Byte[])
function get_bytes(offset: Integer, arr: Byte[], off: Integer, len: Integer)
`
  Copies bytes from given memory location to given array.

### Utility functions

`function find_byte(offset: Integer, value: Byte): Integer
function find_byte(offset: Integer, end_offset: Integer, value: Byte): Integer
function find_short(offset: Integer, value: Short): Integer
function find_short(offset: Integer, end_offset: Integer, value: Short): Integer
function find_int(offset: Integer, value: Integer): Integer
function find_int(offset: Integer, end_offset: Integer, value: Integer): Integer
`
  Searches for value, returning an index (-1 if not found).
`function get_string_length(offset: Integer): Integer`
  Returns length of the zero-terminated string.
`function get_string(offset: Integer): String`
  Returns string from given memory location.
`function get_string_utf8(offset: Integer): String`
  Returns UTF-8 string from given memory location.
`function set_string(offset: Integer, value: String)`
  Sets string at given memory location.
`function set_string_utf8(offset: Integer, value: String)`
  Sets UTF-8 string at given memory location.