package camlid
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=0866552036c452a1cdd05738a76112b761db6cceeeed2b1f5a03d730a19249c0
sha512=dd5854fd1085302b5722ec10fa9452851928c12e4912b7a0ffde2d2831fba99e9d6299483dcfdc6de633959ad8e39f53d6bbbccb3a422bfc9a937988b4a7c267
Description
Camlid generates the C stubs and the OCaml externals of a C library from a description of its functions written in OCaml. The C values are handled like C++ objects (constructor, destructor, copy), and the generated code follows the rules of the OCaml FFI.
Added to opam-repository:
README
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
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by (1)
-
flint
>= "0.5.0"
Conflicts
None
Build status
Results of building camlid with each compiler on check.ci.ocaml.org, run of against opam-repository efadaba. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.3 (this version) | n/a | good | good | good | good |
| 0.2 | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure