package ctypes

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Ctypes_ptr.FatSource

Sourcetype (_, _) t

A fat pointer, which holds a reference to the reference type, the C memory location, and an OCaml object.

Sourceval make : managed:'m -> reftyp:'typ -> voidp -> ('m, 'typ) t

make ?managed ~reftyp raw builds a fat pointer from the reference type reftyp, the C memory location raw, and (optionally) an OCaml value, managed. The managed argument may be used to manage the lifetime of the C object; a typical use it to attach a finaliser to managed which releases the memory associated with the C object whose address is stored in raw_ptr.

Sourceval is_null : (_, _) t -> bool
Sourceval reftype : (_, 'typ) t -> 'typ
Sourceval managed : ('m, _) t -> 'm
Sourceval set_managed : ('m, _) t -> 'm -> unit
Sourceval coerce : ('m, _) t -> 'typ -> ('m, 'typ) t
Sourceval unsafe_raw_addr : (_, _) t -> voidp

Return the raw pointer address. The function is unsafe in the sense that it dissociates the address from the value which manages the memory, which may trigger associated finalisers, invalidating the address.

Sourceval add_bytes : ('m, 'typ) t -> int -> ('m, 'typ) t
Sourceval compare : (_, 'typ) t -> (_, 'typ) t -> int
Sourceval diff_bytes : (_, 'typ) t -> (_, 'typ) t -> int
OCaml

Innovation. Community. Security.