package lintcstubs-arity
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c2691d943123f11bac129dcc75fa791927af71cde7e52a8ebeae6b0f08f08e6b
sha512=5fef8b48b805ac4fad0bb9ff0f100ce3fc97f4ef564092660db5b3a4b7f797ff4b754294579f2e74e3964b584b8d4f7ea1ae6be1f4a025f9b59be7ca60a8e8c5
doc/lintcstubs-arity.primitives_of_cmt/Primitives_of_cmt/index.html
Module Primitives_of_cmt
Source
Typedtree
has an unstable API (depends on compiler version), so extract the parts we need and convert to types defined in this file. If the build breaks with new compiler versions then only this module needs to be updated (perhaps by using Dune's support to conditionally select files based on compiler versions)
ctype_of_native_arg arg
returns the C type used when implementing primitives for native code mode.
type t = {
byte_name : string;
(*name of C function implementing the primitive in bytecode mode
*)native_name : string;
(*name of C function implementinmg the primitive in native code mode
*)arity : int;
(*number of arguments to C function in native code mode
*)alloc : bool;
(*whether it allocates/raises exceptions
*)native_result : native_arg;
(*result type of the C function implementing the primitive in native code mode
*)native_args : native_arg list;
(*type of the arguments of the C function implementing the primitive in native code mode
*)
}
iter_primitives_exn ~path primitive_description
will load the .cmt/.cmti file path
and iterate on any primitives defined using primitive_description
.
Exceptions from compiler-libs may escape, so it is recommended to wrap calls using with_report_exceptions
.
with_report_exceptions f
will report any compiler-libs exceptions escaping from f
and exit the process with code 2.