[Haskell-cafe] Troubles with FFI

Simon Peyton-Jones simonpj at microsoft.com
Mon May 15 06:15:31 EDT 2006


| > the automated ones, seemed to handle the case of passing numerical
| > arrays to C, and having them get updated and passed back.  That is
my
| > primary interest in the FFI and yet no obvious solution or example
| > could be found after days of internet searching and pouring over
| > tutorials etc.
| 
| Regarding arrays, generally you'd use a Foreign array, allocate it on
| the C side, and access it via a Foreign Ptr, no marshalling.
| 
| Also, feel free to ask advice on haskell-cafe at haskell.org, or on the
| #haskell irc channel. There's lots of experts only too happy to help
| out.

All true.  Still, Matthew is by-definition correct: he was strongly
motivated, and yet failed to find the relevant material.  Indeed,
concerning the question of passing array values between C and Haskell,
there may be no overview or tutorial, thus far.

Matthew, the entire Haskell.org website is a Wiki.  You might spare
someone else the pain that you went through by starting a "Duffers guide
to the Haskell FFI" that contains the information you wished you'd known
on day 1.  I'm sure you'd get lots of help on the #haskell IRC if you
did so.

Simon


More information about the Haskell-Cafe mailing list