caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Adrien Nader <adrien@notk.org>
To: "Markus Weißmann" <markus.weissmann@in.tum.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] detecting 32/64 bit from C
Date: Tue, 13 Oct 2015 14:24:23 +0200	[thread overview]
Message-ID: <20151013122423.GA20981@notk.org> (raw)
In-Reply-To: <4f63fa9ca9f594db57e700165c0dd674@in.tum.de>

On Tue, Oct 13, 2015, Markus Weißmann wrote:
> Hello,
> 
> is there some "official" way to detect -- from C -- if OCaml was
> compiled for 32 or 64 bit?
> I'd love to have something like a #define that either says 32 or 64
> bit;
> I need to know at compile time if the OCaml system uses 31 or 63 bit
> sized integers (in the C code).
> I don't care what the underlying OS or hardware does, but just what
> OCaml is using.
> 
> Btw.: Is [Sys.word_size = 32] for 32 bit OCaml compilers on 64 bit
> machines?

Hi,

I believe config.h has the info you want:
  #define ARCH_SIXTYFOUR // for instance

Note how it's installed under $(libdir) and not $(includedir): its
content is set at configure-time and depends on the architecture that
ocaml has been configured for.

-- 
Adrien Nader

  reply	other threads:[~2015-10-13 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 12:04 Markus Weißmann
2015-10-13 12:24 ` Adrien Nader [this message]
2015-10-13 14:07   ` Gerd Stolpmann
2015-10-13 14:19     ` Markus Weißmann

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=20151013122423.GA20981@notk.org \
    --to=adrien@notk.org \
    --cc=caml-list@inria.fr \
    --cc=markus.weissmann@in.tum.de \
    /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).