Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4618576
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:17:13+00:00 2026-05-22T02:17:13+00:00

I am working on some code that mixes OCaml and C, the functions caml_release_runtime_system()

  • 0

I am working on some code that mixes OCaml and C, the functions caml_release_runtime_system() and caml_acquire_runtime_system() were introduced in OCaml 3.12 (they were called something else in earlier versions) but I would like to be compatible back to 3.10 if possible, is there an #ifdef I can use for that? I have had a look through the headers (in /usr/lib/ocaml/caml on my Debian system) and can’t find anything that looks like it might. Thanks!

UPDATE: this is what I did

This is what I did:

#if OCAML_VERSION_MINOR >= 12
#include <caml/threads.h>
#else
#include <caml/signals.h>
#endif 

#ifndef caml_acquire_runtime_system
#define caml_acquire_runtime_system caml_leave_blocking_section
#define caml_release_runtime_system caml_enter_blocking_section
#endif
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:17:14+00:00Added an answer on May 22, 2026 at 2:17 am

    The ocamlopt and ocamlc binaries supports -vnum and -version switches for getting the version number:

    -vnum or -version
    Print the version number of the compiler in short form (e.g. 3.11.0), then exit.

    This switch is supported in 3.12.0 and the example text in the documentation suggests that 3.11.0 also supports it. I don’t have 3.10.0 handy but nlucaroni (whose OCaml Fu looks stronger than mine) indicates in the comments that 3.10.0 does have ocamplopt -version.

    So you could add something like this to your Makefile:

    OCAML_VERSION_MAJOR = `ocamlopt -version | cut -f1 -d.`
    OCAML_VERSION_MINOR = `ocamlopt -version | cut -f2 -d.`
    OCAML_VERSION_POINT = `ocamlopt -version | cut -f3 -d.`
    

    And then pass those to your compiler using -DOCAML_VERSION_MAJOR=$(OCAML_VERSION_MAJOR), -DOCAML_VERSION_MINOR=$(OCAML_VERSION_MINOR), …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on some code that uses the System.Diagnostics.Trace class and I'm wondering how
I'm working with some code that is confusing me and I'm wondering if I'm
I'm working with some code that widely uses the idiom of returning a pointer
We are working with some legacy code that accesses a shared drive by the
Ok, this is a curly one. I'm working on some Delphi code that I
I have been working on some legacy C++ code that uses variable length structures
I'm trying to get some code working that a previous developer has written. Yep,
I'm working with some number crunching code that, by its nature, is floating-point intensive
I'm working with some old PHP code that has a lot of the following:
I was working on some code recently and came across a method that had

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.