Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

define CAML_COMPATIBILITY_H to allow more idents #712

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yilinwei
Copy link

@yilinwei yilinwei commented Jul 22, 2022

compatibility.h defines preprocessor macros which means certain identifiers, such as alloc cannot be used. The preprocessor expands the identifier into caml_xxx in the offset_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 ocaml 5, but is present until 4.14.

`compatibility.h` defines preprocessor macros which
means certain identifiers, such as `alloc` cannot be
used.

This is a problem when binding with cstubs when structs
have fields with the same identifiers.
@MisterDA
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants