On Thu, May 22, 2003 at 07:05:38PM +1000, Manuel M T Chakravarty wrote:
> Ross Paterson <[EMAIL PROTECTED]> 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. - [EMAIL PROTECTED]
---------------------------------------------------------------------------
_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi

Reply via email to