123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051(*
* Copyright (c) 2013 Jeremy Yallop.
*
* This file is distributed under the terms of the MIT License.
* See the file LICENSE for details.
*)(* Stubs for reading and writing memory. *)openCtypes_ptr(* A reference, managed by the garbage collector, to a region of memory in the
C heap. *)typemanaged_buffer(* Allocate a region of stable, zeroed memory managed by a custom block. *)externalallocate:int->int->managed_buffer="ctypes_allocate"(* Obtain the address of the managed block. *)externalblock_address:managed_buffer->voidp="ctypes_block_address"(* Read a C value from a block of memory *)externalread:'aCtypes_primitive_types.prim->_Fat.t->'a="ctypes_read"(* Write a C value to a block of memory *)externalwrite:'aCtypes_primitive_types.prim->'a->_Fat.t->unit="ctypes_write"[@@noalloc]modulePointer=structexternalread:_Fat.t->voidp="ctypes_read_pointer"externalwrite:_Fat.t->_Fat.t->unit="ctypes_write_pointer"end(* Copy [size] bytes from [src] to [dst]. *)externalmemcpy:dst:_Fat.t->src:_Fat.t->size:int->unit="ctypes_memcpy"(* Read a fixed length OCaml string from memory *)externalstring_of_array:_Fat.t->len:int->string="ctypes_string_of_array"(* Do nothing, concealing from the optimizer that nothing is being done. *)externaluse_value:'a->unit="ctypes_use"[@@noalloc]