package camlid
All checked builds pass sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Generate the C stubs of a C library from a description in OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
camlid-0.3.tbz
sha256=0866552036c452a1cdd05738a76112b761db6cceeeed2b1f5a03d730a19249c0
sha512=dd5854fd1085302b5722ec10fa9452851928c12e4912b7a0ffde2d2831fba99e9d6299483dcfdc6de633959ad8e39f53d6bbbccb3a422bfc9a937988b4a7c267
doc/README.html
camlid
Camlid is a C binding generator for OCaml. Its interface is not yet stable.
The description is similar to the extension of IDL found in CamlIDL, but it is a DSL in OCaml and it removes the interface language part of IDL. Moreover it tries to keep a core simple and generic and uses predefined helpers for common types and patterns. It supports automatic unboxing, untagging when possible. The ownership of the allocated memory after the call to a stubbed C function can be specified.
C11 is required.
Quick Example
Suppose the following header (alib.h):
void f_input(int);
void f_output(int *);
int f_with_res();
void f_no_arg_no_result();The following OCaml program produces a basic_stub.c and basic.ml file.
open Camlid
open Helper
let () = Generate.to_file "basic"
~headers:["alib.h"]
[
func "f_input" [ input c_int];
func "f_output" [ output (ptr_ref c_int)];
func "f_with_res" [] ~result:c_int;
func "f_no_arg_no_result" [];
]Then one just need to write basic.mli with the documentation:
(** {2 Alib API} *)
(** set important global information *)
val f_input: int -> unit
(** get important global information *)
val f_output: unit -> int
(** get another very important global information *)
val f_with_res: unit -> int
(** do something really important *)
val f_no_arg_no_result: unit -> unit
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page