[Haskell-cafe] FFI and lists?

Kimberly Wallmark kim at arlim.org
Tue Mar 2 16:19:56 EST 2010

I'm working with FFI to make a Haskell DLL that's called by C# code.   
I understand how to share simple types.  I've found reasonable  
documentation for struct-equivalents.  Is there a clean way to share  
lists, or should I make a linked-list struct and do it manually?

In other words, if I have
   adder :: CInt -> CInt -> CInt
   adder x y = (x+y)

then I can use
   foreign export stdcall adder :: CInt -> CInt -> CInt

and on the other side it behaves like
   int adder(int a, int b);

I'd like to know what to do if I have
   squares :: [CInt] -> [CInt]
   squares = map (^2)



More information about the Haskell-Cafe mailing list