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-22 (05:26)
From: Robert Roessler <roessler@r...>
Subject: Re: [Caml-list] A pair of "Interfacing with C" questions
Jacques Garrigue wrote:
> From: malc <malc@pulsesoft.com>
>>>>I assume the other choices include int64, nativeint, or even int.
>>>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.
> Aargh, they seem to like to break everything!
> Anyway, I suppose it just means that ocaml would have to define value
> as a long long int on Win64, to make it behave like other
> architectures. 
> The sources are full of casts from value to (value *) and back.
> Rather, this is going to be a pain to port many C libraries, that
> assume that you can convert between a long and a pointer and back.

I was worried about something like the Win64 silliness... ;)

Said silliness aside, I will go ahead and switch to nativeint - thanks.

Robert Roessler