[jhc] New Extension: foreign C imports that return multiple values

Henning Thielemann jhc at henning-thielemann.de
Sat Feb 11 13:29:12 CET 2012

On Fri, 10 Feb 2012, John Meacham wrote:

> foreign import ccall "math.h frexp"  c_frexp :: Double -> Ptr CInt -> IO Double
> -- This extension allows it to be declared as so
> foreign import ccall "math.h frexp"  c_frexp :: Double -> (# Double, CInt #)
> -- The second return value is added as the last 'exp' parameter then read out
> -- of the allocated memory. The contents of the memory passed into the function
> -- is undefined.

Nice idea - how does JHC know where the pointer parameters are? Is it 
possible to have the pointer arguments at the first position?

More information about the jhc mailing list