yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

struct field name clashes with ocaml macro #725

Closed joprice closed 1 year ago

joprice commented 1 year ago

I am binding to a struct that defines a field called "callback". This ends up being passed to offsetof, where the pre-processor kicks in and expands it to caml_callback, resulting in the below error.

 has no member named ‘caml_callback’; did you mean ‘callback’?
   71 | #define callback caml_callback
      |                  ^~~~~~~~~~~~~

Is there any way to work around this?

joprice commented 1 year ago

Looks like this is a dupe of https://github.com/yallop/ocaml-ctypes/pull/712