[ocaml-ctypes] Finalising data

Florian Pichlmeier florian.pichlmeier at mytum.de
Wed Apr 30 17:19:24 BST 2014


i have this create function

type t = unit ptr
let zframe : t typ = ptr void 
let zframe_opt : t option typ = ptr_opt void

let create msg = 
  let stub = foreign "zframe_new"
      (string @-> size_t @-> returning zframe_opt)
  let msg_size =  Size_t.of_int (String.length msg) in
  match stub msg msg_size with 
  | None -> raise Frame_creation
  | Some x -> x

How can i tell the garbage collector to call my specific 
destroy function?

Any thougts?


More information about the Ctypes mailing list