Open yilinwei opened 1 year ago
I think the proper fix is to make sure that we're using "namespaced" identifiers in the C code (that is, starting with caml_
when they're defined in the caml headers, and define CAML_NAME_SPACE
which prevents the compatibility.h
header from being included. Surely we don't have to support OCaml versions that are older than the switch to prefixed identifiers?
compatibility.h
defines preprocessor macros which means certain identifiers, such asalloc
cannot be used. The preprocessor expands the identifier intocaml_xxx
in theoffset_of
.This is a problem when binding with cstubs when structs have fields with the same identifiers. Currently, you can manually add this
#define
in the preamble manually as a workaround.Note:
compatibility.h
is removed in ocaml5
, but is present until4.14
.