Skip to content

Commit

Permalink
chore: add Plugin.reset (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Dec 13, 2023
1 parent a042901 commit e6e67a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/bindings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,5 @@ let extism_plugin_cancel =
fn "extism_plugin_cancel" (ptr void @-> returning bool)

let extism_plugin_id = fn "extism_plugin_id" (ptr void @-> returning (ptr char))

let extism_plugin_reset = fn "extism_plugin_reset" (ptr void @-> returning bool)
3 changes: 3 additions & 0 deletions src/extism.mli
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ module Plugin : sig
(** Free a plugin immediately, this isn't normally required unless there are a
lot of plugins open at once *)

val reset : t -> bool
(** Reset the Extism runtime, this will invalidate all allocated memory *)

val function_exists : t -> string -> bool
(** Check if a function is exported by a plugin *)

Expand Down
3 changes: 3 additions & 0 deletions src/plugin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,6 @@ let id { pointer; _ } =
let id = Bindings.extism_plugin_id pointer in
let s = Ctypes.string_from_ptr id ~length:16 in
Uuidm.unsafe_of_bytes s

let reset { pointer; _ } =
Bindings.extism_plugin_reset pointer

0 comments on commit e6e67a7

Please sign in to comment.