package extism

  1. Overview
  2. Docs

Some helpter functions for reading/writing memory

val memory : ?offs:Unsigned.UInt64.t -> t -> Unsigned.uint8 Ctypes.ptr

Get pointer to entire plugin memory

val find : t -> Unsigned.UInt64.t -> memory_handle option

Convert an offset into a memory_handle

val alloc : t -> int -> memory_handle

Allocate a new block of memory

val free : t -> memory_handle -> unit

Free allocated memory

val to_val : memory_handle -> Val.t

Convert memory block to Val

val of_val : t -> Val.t -> memory_handle option

Convert Val to memory block

val of_val_exn : t -> Val.t -> memory_handle

Convert Val to memory block, raises Invalid_argument if the value is not a pointer to a valid memory block

val get_string : t -> memory_handle -> string

Get a string from memory stored at the provided offset

val get_bigstring : t -> memory_handle -> Bigstringaf.t

Get a bigstring from memory stored at the provided offset

val set_string : t -> memory_handle -> string -> unit

Store a string into memory at the provided offset

val set_bigstring : t -> memory_handle -> Bigstringaf.t -> unit

Store a bigstring into memory at the provided offset