English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-07-23 (12:14)
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