Allocates a zero-initialized byte buffer of the given size.
Allocates memory for a C struct of the given Za struct type. The struct must be defined with the 'struct' keyword.
Closes a FILE* pointer. Returns 0 on success.
Opens a file and returns a FILE* pointer. Mode is like C fopen ("r", "w", "rb", "wb", etc).
Frees a C pointer allocated by c_alloc.
Frees a C struct pointer allocated by c_alloc_struct.
Reads a byte at the given offset in a buffer.
Reads a byte at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads a double (64-bit) at the given offset in a buffer.
Reads a double (64-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads a float (32-bit) at the given offset in a buffer.
Reads a float (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads an int16 at the given offset in a buffer.
Reads an int16 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads an int32 at the given offset in a buffer.
Reads an int32 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads an int64 at the given offset in a buffer.
Reads an int64 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads a data symbol (constant/variable) from a loaded C library. Note: C preprocessor #defines are NOT symbols and cannot be read this way.
Reads a uint16 at the given offset in a buffer.
Reads a uint16 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads a uint32 at the given offset in a buffer.
Reads a uint32 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads a uint64 at the given offset in a buffer.
Reads a uint64 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Allocates a C string (char*) from a Za string. The caller is responsible for freeing it with c_free().
Returns a null C pointer for use in FFI calls.
Returns true if the C pointer is null.
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.
Converts a C string pointer (char*) to a Za string. The pointer should reference valid C string memory.
Sets a byte at the given offset in a buffer.
Sets a byte at the given int64 address + offset. For opaque pointers returned from FFI calls.
Writes a double (64-bit) at the given offset in a buffer.
Writes a double (64-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.
Writes a float (32-bit) at the given offset in a buffer.
Writes a float (32-bit) at the given int64 address + offset. For opaque pointers returned from FFI calls.
Sets an int16 at the given offset in a buffer.
Sets an int16 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Sets an int32 at the given offset in a buffer.
Sets an int32 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Sets an int64 at the given offset in a buffer.
Sets an int64 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Copies a Za string to a C buffer at the given pointer. The buffer must be large enough.
Sets a uint16 at the given offset in a buffer.
Sets a uint16 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Sets a uint32 at the given offset in a buffer.
Sets a uint32 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Sets a uint64 at the given offset in a buffer.
Sets a uint64 at the given int64 address + offset. For opaque pointers returned from FFI calls.
Reads C struct data from memory and converts it to a Za struct. Use this for 'out' parameters that C functions fill with data.