I have a C function with type
int func(int len1, int *array1, int len2, int *array2);
that I'd like to call from Haskell. It doesn't modify its contents. I want to pass data from lists. I've been looking through Foreign.Marshal.Array, but I'm quite confused. Either newArray or withArray seems to do what I want, but withArray, for example, takes a function with type
Ptr a -> IO b
And I'm not quite sure how to deal with that given the two arrays in my function. So far, I have:
foreign import ccall unsafe "func.h func"
c_func :: CInt -> Ptr CInt -> CInt -> Ptr CInt -> IO CInt
And I'm not sure how to call this. In the documentation (http://ift.tt/2smTE4w), it just says to read Foreign.Marshall.Array.
Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered