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: Robert Roessler <roessler@r...>
Subject: Re: [Caml-list] A pair of "Interfacing with C" questions
Jacques Garrigue wrote:
> From: malc <>
>>>>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