Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
A pair of "Interfacing with C" questions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] A pair of "Interfacing with C" questions
>> If you look at mlvalues.h you will see that nativeint is define as
>> long int. So this should be the natural format for a pointer.
> I don't think so, Win64 ABI has sizeof(long) == 4 and sizeof(void *) == 8.

... which is why a port of OCaml to Win64 would use long long (or,
better, intptr_t, if available) for the C type "value" and the Caml
type "nativeint".

In other terms, OCaml values are integers big enough to hold a
pointer, and the type nativeint has (by construction) the same size as
a value.

- Xavier Leroy