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: 2005-07-22 (09:31)
From: Alexander S. Usov <A.S.Usov@k...>
Subject: Re: [Caml-list] A pair of "Interfacing with C" questions
On Friday 22 July 2005 07:26, Robert Roessler wrote:
> 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.

According to
they have chosen LLP64 model, while almost everybody else are using LP64. 
Quite funny choice I  should say.

But from the other point of view -- isn't it possible to make the compiler to 
complain hard when you are trying to convert int/long to pointer?

Best regards,