[Haskell-cafe] FunPtr to C function with #arguments determined atruntime?

Donn Cave donn at avvanta.com
Mon Feb 18 02:44:38 CET 2013


Quoth Ryan Newton <rrnewton at gmail.com>,
...
> Anyway, in this case it wasn't *too *painful to just generate a bunch of
> extra boilerplate C functions for (1) creating a data structure to hold the
> arguments, (2) loading them in one at a time, and (3) deallocating the
> structure when the call is done.  Yuck.  But no extra dependencies.

If I understand you right, that's a better direction in my view -
and when I've done stuff like this I've allocated and marshalled the
data structure from the Haskell side fairly painlessly with
Foreign.Storable(poke) etc., and the .hsc preprocessor macros for
struct access (#poke, etc.)

	Donn



More information about the Haskell-Cafe mailing list