* [Caml-list] detecting 32/64 bit from C
@ 2015-10-13 12:04 Markus Weißmann
2015-10-13 12:24 ` Adrien Nader
0 siblings, 1 reply; 4+ messages in thread
From: Markus Weißmann @ 2015-10-13 12:04 UTC (permalink / raw)
To: caml-list
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?
Regards
-Markus
--
Markus Weißmann, M.Sc.
Technische Universität München
Institut für Informatik
Boltzmannstr. 3
D-85748 Garching
Germany
http://wwwknoll.in.tum.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] detecting 32/64 bit from C
2015-10-13 12:04 [Caml-list] detecting 32/64 bit from C Markus Weißmann
@ 2015-10-13 12:24 ` Adrien Nader
2015-10-13 14:07 ` Gerd Stolpmann
0 siblings, 1 reply; 4+ messages in thread
From: Adrien Nader @ 2015-10-13 12:24 UTC (permalink / raw)
To: Markus Weißmann; +Cc: caml-list
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] detecting 32/64 bit from C
2015-10-13 12:24 ` Adrien Nader
@ 2015-10-13 14:07 ` Gerd Stolpmann
2015-10-13 14:19 ` Markus Weißmann
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Stolpmann @ 2015-10-13 14:07 UTC (permalink / raw)
To: Adrien Nader; +Cc: Markus Weißmann, caml-list
[-- Attachment #1: Type: text/plain, Size: 1409 bytes --]
Am Dienstag, den 13.10.2015, 14:24 +0200 schrieb Adrien Nader:
> 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?
Yes.
>
> Hi,
>
> I believe config.h has the info you want:
> #define ARCH_SIXTYFOUR // for instance
Exactly.
> 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.
config.h should be available in $stdlib/caml. It is included from the
other header files.
Gerd
> --
> Adrien Nader
>
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] detecting 32/64 bit from C
2015-10-13 14:07 ` Gerd Stolpmann
@ 2015-10-13 14:19 ` Markus Weißmann
0 siblings, 0 replies; 4+ messages in thread
From: Markus Weißmann @ 2015-10-13 14:19 UTC (permalink / raw)
To: Gerd Stolpmann; +Cc: Adrien Nader, caml-list
Perfect -- thanks a lot!
-Markus
On 2015-10-13 16:07, Gerd Stolpmann wrote:
> Am Dienstag, den 13.10.2015, 14:24 +0200 schrieb Adrien Nader:
>> 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?
>
> Yes.
>
>>
>> Hi,
>>
>> I believe config.h has the info you want:
>> #define ARCH_SIXTYFOUR // for instance
>
> Exactly.
>
>> 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.
>
> config.h should be available in $stdlib/caml. It is included from the
> other header files.
>
> Gerd
>
>> --
>> Adrien Nader
>>
--
Markus Weißmann, M.Sc.
Technische Universität München
Institut für Informatik
Boltzmannstr. 3
D-85748 Garching
Germany
http://wwwknoll.in.tum.de/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-13 14:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 12:04 [Caml-list] detecting 32/64 bit from C Markus Weißmann
2015-10-13 12:24 ` Adrien Nader
2015-10-13 14:07 ` Gerd Stolpmann
2015-10-13 14:19 ` Markus Weißmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox