caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kaustuv Chaudhuri <kaustuv.chaudhuri@inria.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Checking for caml version from C
Date: Wed, 15 Sep 2010 23:14:51 +0200	[thread overview]
Message-ID: <AANLkTin=1v_dWttitGYufEu59ix04QGBivCAEOtMFnZp@mail.gmail.com> (raw)
In-Reply-To: <20100915192954.GA8555@yeeloong>

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


      reply	other threads:[~2010-09-15 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 19:29 rixed
2010-09-15 21:14 ` Kaustuv Chaudhuri [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTin=1v_dWttitGYufEu59ix04QGBivCAEOtMFnZp@mail.gmail.com' \
    --to=kaustuv.chaudhuri@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).