Closed vincentdchan closed 3 years ago
This is the expected behaviour, unfortunately: it's due to a limitation in the library underlying Foreign
(libffi).
You'll need to use stub generation to call C functions that accept unions as arguments.
It's Ok. But it seems that all the tutorials are talking about how to use Foreign
. Is there some tutorials about using stub generation?
The blog post Type-safe C bindings #1: Using ocaml-ctypes and stub generation gives a brief introduction. It might also be helpful to look at a project that uses stub generation, such as ocaml-yaml or ocaml-lz4.
Very well, thank you!
I am trying to call C function with union types, but an error occurs: