ANN: H98 FFI Addendum 1.0, Release Candidate 9

John Meacham john at repetae.net
Tue May 27 17:06:56 EDT 2003


On Thu, May 22, 2003 at 07:05:38PM +1000, Manuel M T Chakravarty wrote:
> Ross Paterson <ross at soi.city.ac.uk> wrote,
> > and a query: why are there conversions between StablePtr a and (Fun)Ptr a,
> 
> In tool-generated bindings, it is sometimes more convenient
> to cast to a Ptr and pass the Ptr.
> 
> > and HsStablePtr constrained to (void *)?
> 
> This is a kludge.  Essentially, we would like an abstract
> type and (void *) is the closest you get in C (and what is
> typically used in C APIs for the same purpose).  It is
> important to be concrete about the type to fix the storage
> requirements.


There is also uintptr_t and intptr_t, integral types guarenteed to be
able to hold a  (void *). very handy for storing a token which might be
a number or pointer and you want to be able to safely cast between them.
        John

-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john at foo.net
---------------------------------------------------------------------------



More information about the FFI mailing list