Version française
Home     About     Download     Resources     Contact us    
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: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] A pair of "Interfacing with C" questions
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.

Jacques Garrigue