package extism

  1. Overview
  2. Docs

Module Host_function.Memory_handleSource

Some helpter functions for reading/writing memory

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

Get pointer to entire plugin memory

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

Convert an offset into a memory_handle

Sourceval alloc : t -> int -> memory_handle

Allocate a new block of memory

Sourceval free : t -> memory_handle -> unit

Free allocated memory

Sourceval to_val : memory_handle -> Val.t

Convert memory block to Val

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

Convert Val to memory block

Sourceval 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

Sourceval get_string : t -> memory_handle -> string

Get a string from memory stored at the provided offset

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

Get a bigstring from memory stored at the provided offset

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

Store a string into memory at the provided offset

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

Store a bigstring into memory at the provided offset

OCaml

Innovation. Community. Security.