* Checking for caml version from C
@ 2010-09-15 19:29 rixed
2010-09-15 21:14 ` [Caml-list] " Kaustuv Chaudhuri
0 siblings, 1 reply; 2+ messages in thread
From: rixed @ 2010-09-15 19:29 UTC (permalink / raw)
To: caml-list
Hello !
I'm using ocaml 3.11 and 3.12 and I'm writting some C code
that use caml_enter/leave_blocking_section. I'd like to know if
there is a standard way to check for Ocaml version with the C preprocessor
in order to switch to caml_release/acquire_runtime_system if version is
>= 3.12 ?
I grepped for VERSION in all the caml/*.h files without success.
How am I supposed to do ?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Checking for caml version from C
2010-09-15 19:29 Checking for caml version from C rixed
@ 2010-09-15 21:14 ` Kaustuv Chaudhuri
0 siblings, 0 replies; 2+ messages in thread
From: Kaustuv Chaudhuri @ 2010-09-15 21:14 UTC (permalink / raw)
To: caml-list
On Wed, Sep 15, 2010 at 9:29 PM, <rixed@happyleptic.org> wrote:
> I'd like to know if there is a standard way to check for
> Ocaml version with the C preprocessor
Not sure about standard ways, but here's one ugly way:
% cat ugly.c
#if OCAML_MAJOR == 3 && OCAML_MINOR == 12
Hello 3.12 world
#else
Hello non-3.12 world
#endif
% ocamlc -version
3.12.1+dev4 (2010-09-03)
% ocamlc \
-ccopt -DOCAML_MAJOR=`ocamlc -version | cut -d'.' -f1` \
-ccopt -DOCAML_MINOR=`ocamlc -version | cut -d'.' -f2` \
-ccopt -E \
ugly.c
# 1 "ugly.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "ugly.c"
Hello 3.12 world
(Drop the -ccopt -E option when you use it, obviously.)
-- Kaustuv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-15 21:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-15 19:29 Checking for caml version from C rixed
2010-09-15 21:14 ` [Caml-list] " Kaustuv Chaudhuri
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox