[C2hs] Marshal Haskell list into monolithic arrays
duncan.coutts at worc.ox.ac.uk
Thu Aug 17 10:39:39 EDT 2006
On Thu, 2006-08-17 at 14:20 +0000, zhu Jun wrote:
> Hi all,
> There is a 'newArray' operation in MarshallArray to marshal Haskell list,
> with the definination of 'newArray :: Storable a => [a] -> IO (Ptr a)'.
> However, when I pass the 'Ptr a' to a C function, only the the first
> element of the list is available in C.
> Could anyone give some hints?
> The C function looks like:
> void lowPassFilter(float *fs, float *sum)
> // Only *fs is available here, why?
> with the import call in Haskell like this:
> foreign import ccall safe "lowPassFilter" lowPassFilter :: Ptr (CFloat) ->
> Ptr (CFloat) -> IO (())
How are you calling this? Show us the code where you use lowPassFilter
> Should I use ' lowPassFilter :: Ptr ([CFloat]) -> Ptr (CFloat) -> IO (())',
> and define 'float fs' to be Storable in Haskell?
More information about the C2hs