Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
C includes don't provide a revision number #5666
Original bug ID: 5666
I am planning to include support for both 3.x and 4.x versions of the C API in the C stub parts of my libraries. However, I couldn't find a define in the C headers to verify which version of the runtime I'm compiling against. There's at least one change in the C API (one more field in the custom_operations struct), which can be easily tested without this feature, but I wonder if a more general way of checking the API version wouldn't be desirable.
Comment author: @damiendoligez
Instead of providing a C include file, which would only work for future versions of OCaml, I wrote a shell script that produces such an include file from the version number provided by ocamlc. I suggest that you include a copy of that script with your sources and use it in your Makefile.
I have uploaded it here, and added it to the tools/ directory.
Comment author: didc
My bad, I had ver. 3.11 and tried ver. 4 and assumed it was new. If it's the only thing that changed since then, it's probably not so much of a hurdle.