Return to index

ffi functions

cpointer = c_alloc(size)

top

Allocates a zero-initialized byte buffer of the given size.


cpointer = c_alloc_array(type_string,count)

top

Allocates a zero-initialized buffer for 'count' elements of the scalar type named by type_string.


cpointer = c_alloc_array_uninit(type_string,count)

top

Allocates a raw buffer (NOT zero-initialized) for 'count' scalar elements. Caller must write every element before reading.


cpointer = c_alloc_bytes(count)

top

Allocates a zero-initialized buffer for 'count' byte (uint8) elements.


cpointer = c_alloc_floats32(count)

top

Allocates a zero-initialized buffer for 'count' float32 elements.


cpointer = c_alloc_floats64(count)

top

Allocates a zero-initialized buffer for 'count' float64 elements.


cpointer = c_alloc_int16s(count)

top

Allocates a zero-initialized buffer for 'count' int16 elements.


cpointer = c_alloc_int32s(count)

top

Allocates a zero-initialized buffer for 'count' int32 elements.


cpointer = c_alloc_int64s(count)

top

Allocates a zero-initialized buffer for 'count' int64 elements.


cpointer = c_alloc_int8s(count)

top

Allocates a zero-initialized buffer for 'count' int8 elements.


cpointer = c_alloc_struct(struct_type_name)

top

Allocates memory for a C struct of the given Za struct type. The struct must be defined with the 'struct' keyword.


cpointer = c_alloc_uint16s(count)

top

Allocates a zero-initialized buffer for 'count' uint16 elements.


cpointer = c_alloc_uint32s(count)

top

Allocates a zero-initialized buffer for 'count' uint32 elements.


cpointer = c_alloc_uint64s(count)

top

Allocates a zero-initialized buffer for 'count' uint64 elements.


cpointer = c_alloc_uint8s(count)

top

Allocates a zero-initialized buffer for 'count' uint8 elements.


cpointer = c_alloc_uninit(size)

top

Allocates a raw byte buffer (NOT zero-initialized). Caller must write every byte before reading.


[]float32 = c_array_bulk_get_float32(ptr,start_index,count)

top

Reads multiple float32 values starting at the given element index and returns them as a []float32 Za array.


[]float = c_array_bulk_get_float64(ptr,start_index,count)

top

Reads multiple float64 values starting at the given element index and returns them as a Za array.


[]int16 = c_array_bulk_get_int16(ptr,start_index,count)

top

Reads multiple int16 values starting at the given element index and returns them as a [][int16] typed Za array.


[]int32 = c_array_bulk_get_int32(ptr,start_index,count)

top

Reads multiple int32 values starting at the given element index and returns them as a [][int32] typed Za array.


[]int64 = c_array_bulk_get_int64(ptr,start_index,count)

top

Reads multiple int64 values starting at the given element index and returns them as a [][int64] typed Za array.


[]int8 = c_array_bulk_get_int8(ptr,start_index,count)

top

Reads multiple int8 values starting at the given element index and returns them as a [][int8] typed Za array.


[]uint16 = c_array_bulk_get_uint16(ptr,start_index,count)

top

Reads multiple uint16 values starting at the given element index and returns them as a [][uint16] typed Za array.


[]uint32 = c_array_bulk_get_uint32(ptr,start_index,count)

top

Reads multiple uint32 values starting at the given element index and returns them as a [][uint32] typed Za array.


[]uint64 = c_array_bulk_get_uint64(ptr,start_index,count)

top

Reads multiple uint64 values starting at the given element index and returns them as a [][uint64] typed Za array.


[]uint8 = c_array_bulk_get_uint8(ptr,start_index,count)

top

Reads multiple uint8 values starting at the given element index and returns them as a [][uint8] typed Za array.


c_array_bulk_set_float32(ptr,start_index,values)

top

Writes multiple float32 values starting at the given element index.


c_array_bulk_set_float64(ptr,start_index,values)

top

Writes multiple float64 values starting at the given element index.


c_array_bulk_set_int16(ptr,start_index,values)

top

Writes multiple int16 values ([][int16] typed array) starting at the given element index.


c_array_bulk_set_int32(ptr,start_index,values)

top

Writes multiple int32 values ([][int32] typed array) starting at the given element index.


c_array_bulk_set_int64(ptr,start_index,values)

top

Writes multiple int64 values ([][int64] typed array) starting at the given element index.


c_array_bulk_set_int8(ptr,start_index,values)

top

Writes multiple int8 values ([][int8] typed array) starting at the given element index.


c_array_bulk_set_uint16(ptr,start_index,values)

top

Writes multiple uint16 values ([][uint16] typed array) starting at the given element index.


c_array_bulk_set_uint32(ptr,start_index,values)

top

Writes multiple uint32 values ([][uint32] typed array) starting at the given element index.


c_array_bulk_set_uint64(ptr,start_index,values)

top

Writes multiple uint64 values ([][uint64] typed array) starting at the given element index.


c_array_bulk_set_uint8(ptr,start_index,values)

top

Writes multiple uint8 values ([][uint8] typed array) starting at the given element index.


[]float32 = c_array_copy_from_c_float32(src_c_ptr,count)

top

Reads count float32 values from a C buffer into a []float32 Za array.


[]float = c_array_copy_from_c_float64(src_c_ptr,count)

top

Reads count float64 values from a C buffer into a Za array.


[]int16 = c_array_copy_from_c_int16(src_c_ptr,count)

top

Reads count int16 values from a C buffer into a [][int16] Za array.


[]int32 = c_array_copy_from_c_int32(src_c_ptr,count)

top

Reads count int32 values from a C buffer into a [][int32] Za array.


[]int64 = c_array_copy_from_c_int64(src_c_ptr,count)

top

Reads count int64 values from a C buffer into a [][int64] Za array.


[]int8 = c_array_copy_from_c_int8(src_c_ptr,count)

top

Reads count int8 values from a C buffer into a [][int8] Za array.


[]uint16 = c_array_copy_from_c_uint16(src_c_ptr,count)

top

Reads count uint16 values from a C buffer into a [][uint16] Za array.


[]uint32 = c_array_copy_from_c_uint32(src_c_ptr,count)

top

Reads count uint32 values from a C buffer into a [][uint32] Za array.


[]uint64 = c_array_copy_from_c_uint64(src_c_ptr,count)

top

Reads count uint64 values from a C buffer into a [][uint64] Za array.


[]uint8 = c_array_copy_from_c_uint8(src_c_ptr,count)

top

Reads count uint8 values from a C buffer into a [][uint8] Za array.


c_array_copy_to_c_float32(src_za_array,dst_c_ptr)

top

Copies an entire Za array into a C float32 buffer.


c_array_copy_to_c_float64(src_za_array,dst_c_ptr)

top

Copies an entire Za array into a C float64 buffer.


c_array_copy_to_c_int16(src_za_array,dst_c_ptr)

top

Copies an entire [][int16] Za array into a C int16 buffer.


c_array_copy_to_c_int32(src_za_array,dst_c_ptr)

top

Copies an entire [][int32] Za array into a C int32 buffer.


c_array_copy_to_c_int64(src_za_array,dst_c_ptr)

top

Copies an entire [][int64] Za array into a C int64 buffer.


c_array_copy_to_c_int8(src_za_array,dst_c_ptr)

top

Copies an entire [][int8] Za array into a C int8 buffer.


c_array_copy_to_c_uint16(src_za_array,dst_c_ptr)

top

Copies an entire [][uint16] Za array into a C uint16 buffer.


c_array_copy_to_c_uint32(src_za_array,dst_c_ptr)

top

Copies an entire [][uint32] Za array into a C uint32 buffer.


c_array_copy_to_c_uint64(src_za_array,dst_c_ptr)

top

Copies an entire [][uint64] Za array into a C uint64 buffer.


c_array_copy_to_c_uint8(src_za_array,dst_c_ptr)

top

Copies an entire [][uint8] Za array into a C uint8 buffer.


float = c_array_get_float32(ptr,index)

top

Reads a float32 at the given element index in a buffer.


float = c_array_get_float64(ptr,index)

top

Reads a float64 at the given element index in a buffer.


int16 = c_array_get_int16(ptr,index)

top

Reads a int16 at the given element index in a buffer.


int32 = c_array_get_int32(ptr,index)

top

Reads a int32 at the given element index in a buffer.


int64 = c_array_get_int64(ptr,index)

top

Reads a int64 at the given element index in a buffer.


int8 = c_array_get_int8(ptr,index)

top

Reads a int8 at the given element index in a buffer.


uint16 = c_array_get_uint16(ptr,index)

top

Reads a uint16 at the given element index in a buffer.


uint32 = c_array_get_uint32(ptr,index)

top

Reads a uint32 at the given element index in a buffer.


uint64 = c_array_get_uint64(ptr,index)

top

Reads a uint64 at the given element index in a buffer.


uint8 = c_array_get_uint8(ptr,index)

top

Reads a uint8 at the given element index in a buffer.


c_array_set_float32(ptr,index,value)

top

Writes a float32 at the given element index in a buffer.


c_array_set_float64(ptr,index,value)

top

Writes a float64 at the given element index in a buffer.


c_array_set_int16(ptr,index,value)

top

Writes a int16 at the given element index in a buffer.


c_array_set_int32(ptr,index,value)

top

Writes a int32 at the given element index in a buffer.


c_array_set_int64(ptr,index,value)

top

Writes a int64 at the given element index in a buffer.


c_array_set_int8(ptr,index,value)

top

Writes a int8 at the given element index in a buffer.


c_array_set_uint16(ptr,index,value)

top

Writes a uint16 at the given element index in a buffer.


c_array_set_uint32(ptr,index,value)

top

Writes a uint32 at the given element index in a buffer.


c_array_set_uint64(ptr,index,value)

top

Writes a uint64 at the given element index in a buffer.


c_array_set_uint8(ptr,index,value)

top

Writes a uint8 at the given element index in a buffer.


int = c_fclose(file_ptr)

top

Closes a FILE* pointer. Returns 0 on success.


cpointer = c_fopen(path,mode)

top

Opens a file and returns a FILE* pointer. Mode is like C fopen ("r", "w", "rb", "wb", etc).


c_free(ptr)

top

Frees a C pointer allocated by c_alloc.


c_free_struct(struct_ptr)

top

Frees a C struct pointer allocated by c_alloc_struct.


int = c_get_byte(ptr,offset)

top

Reads a byte at the given offset in a buffer.


int = c_get_byte_at_addr(address,offset)

top

Reads a byte at the given int64 address + offset. For opaque pointers returned from FFI calls.


float = c_get_double(ptr,offset)

top

Reads a double (64-bit) at the given offset in a buffer.


float = c_get_double_at_addr(address,offset)

top

Reads a double (64-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


float = c_get_float(ptr,offset)

top

Reads a float (32-bit) at the given offset in a buffer.


float32 = c_get_float32(ptr,offset)

top

Reads a float32 (32-bit) at the given offset in a buffer.


float32 = c_get_float32_at_addr(address,offset)

top

Reads a float32 (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


float = c_get_float_at_addr(address,offset)

top

Reads a float (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


int = c_get_int16(ptr,offset)

top

Reads an int16 at the given offset in a buffer.


int = c_get_int16_at_addr(address,offset)

top

Reads an int16 at the given int64 address + offset. For opaque pointers returned from FFI calls.


int = c_get_int32(ptr,offset)

top

Reads an int32 at the given offset in a buffer.


int = c_get_int32_at_addr(address,offset)

top

Reads an int32 at the given int64 address + offset. For opaque pointers returned from FFI calls.


int = c_get_int64(ptr,offset)

top

Reads an int64 at the given offset in a buffer.


int = c_get_int64_at_addr(address,offset)

top

Reads an int64 at the given int64 address + offset. For opaque pointers returned from FFI calls.


any = c_get_symbol(library_alias,symbol_name)

top

Reads a data symbol (constant/variable) from a loaded C library. Note: C preprocessor #defines are NOT symbols and cannot be read this way.


int = c_get_uint16(ptr,offset)

top

Reads a uint16 at the given offset in a buffer.


int = c_get_uint16_at_addr(address,offset)

top

Reads a uint16 at the given int64 address + offset. For opaque pointers returned from FFI calls.


int = c_get_uint32(ptr,offset)

top

Reads a uint32 at the given offset in a buffer.


int = c_get_uint32_at_addr(address,offset)

top

Reads a uint32 at the given int64 address + offset. For opaque pointers returned from FFI calls.


uint = c_get_uint64(ptr,offset)

top

Reads a uint64 at the given offset in a buffer.


uint = c_get_uint64_at_addr(address,offset)

top

Reads a uint64 at the given int64 address + offset. For opaque pointers returned from FFI calls.


cpointer = c_new_string(str)

top

Allocates a C string (char*) from a Za string. The caller is responsible for freeing it with c_free().


cpointer = c_null()

top

Returns a null C pointer for use in FFI calls.


bool = c_ptr_is_null(ptr)

top

Returns true if the C pointer is null.


int = c_ptr_to_int(ptr)

top

Converts a C pointer to an integer. Useful for size_t, uintptr_t, and other integer-valued returns. Tip: Can also use ptr.ToInt() method for convenience.


string = c_ptr_to_string(ptr)

top

Converts a C string pointer (char*) to a Za string. The pointer should reference valid C string memory.


c_set_byte(ptr,offset,value)

top

Sets a byte at the given offset in a buffer.


c_set_byte_at_addr(address,offset,value)

top

Sets a byte at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_double(ptr,offset,value)

top

Writes a double (64-bit) at the given offset in a buffer.


c_set_double_at_addr(address,offset,value)

top

Writes a double (64-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_float(ptr,offset,value)

top

Writes a float (32-bit) at the given offset in a buffer. Accepts float64 or float32.


c_set_float32(ptr,offset,value)

top

Writes a float32 (32-bit) at the given offset in a buffer.


c_set_float32_at_addr(address,offset,value)

top

Writes a float32 (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_float_at_addr(address,offset,value)

top

Writes a float (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_int16(ptr,offset,value)

top

Sets an int16 at the given offset in a buffer.


c_set_int16_at_addr(address,offset,value)

top

Sets an int16 at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_int32(ptr,offset,value)

top

Sets an int32 at the given offset in a buffer.


c_set_int32_at_addr(address,offset,value)

top

Sets an int32 at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_int64(ptr,offset,value)

top

Sets an int64 at the given offset in a buffer.


c_set_int64_at_addr(address,offset,value)

top

Sets an int64 at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_string(ptr,str)

top

Copies a Za string to a C buffer at the given pointer. The buffer must be large enough.


c_set_uint16(ptr,offset,value)

top

Sets a uint16 at the given offset in a buffer.


c_set_uint16_at_addr(address,offset,value)

top

Sets a uint16 at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_uint32(ptr,offset,value)

top

Sets a uint32 at the given offset in a buffer.


c_set_uint32_at_addr(address,offset,value)

top

Sets a uint32 at the given int64 address + offset. For opaque pointers returned from FFI calls.


c_set_uint64(ptr,offset,value)

top

Sets a uint64 at the given offset in a buffer.


c_set_uint64_at_addr(address,offset,value)

top

Sets a uint64 at the given int64 address + offset. For opaque pointers returned from FFI calls.


struct = c_unmarshal_struct(struct_ptr,struct_type_name)

top

Reads C struct data from memory and converts it to a Za struct. Use this for 'out' parameters that C functions fill with data.