FFI Help

Matthew Donadio m.p.donadio@ieee.org
Wed, 04 Jun 2003 16:33:17 -0400


Malcolm Wallace wrote:
> > > > foreign import ccall "math.h signgam" signgamC :: IO Int
> >
> > signgam is an "int" variable, but this assumes that it is a function
> > of type "int signgam(void)".
> >
> > Write a C wrapper "int get_signgam(void) { return signgam; }" and
> > import that.
> 
> Or alternatively, foreign import the address of the int and read it
> directly with 'peek'.

Thanks for the clarification.  I went with the second option, and that
works great.

-- 
Matthew Donadio (m.p.donadio@ieee.org)