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

2013-02-19 Thread Ertugrul Söylemez
Ryan Newton rrnew...@gmail.com wrote: My problem is that I can't create a type representing what I want at the Haskell type-check time, and I need such a type for either casting or a foreign import. For example, let's say the function takes a number of Int arguments between 1 and 1000. If I

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

2013-02-18 Thread Daniel Peebles
Considering that the GHC FFI is already built on libffi (I'm reasonably sure) it seems unnecessary for the Hackage library to depend on an external version. Is it not already getting linked in? On Sun, Feb 17, 2013 at 6:53 PM, Ryan Newton rrnew...@gmail.com wrote: The scenario is pretty

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

2013-02-17 Thread Donn Cave
Quoth Ryan Newton rrnew...@gmail.com, The scenario is pretty simple. I generate C code at runtime. I compile it to a .so. I know how many arguments it expects (but only at runtime), and I get a FunPtr back from 'dlsym'. How do I call it? I was hoping there would be some Raw lower level

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

2013-02-17 Thread Ryan Newton
The scenario is pretty simple. I generate C code at runtime. I compile it to a .so. I know how many arguments it expects (but only at runtime), and I get a FunPtr back from 'dlsym'. How do I call it? I feel that I might be confused about the problem, but since I don't see anyone

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

2013-02-17 Thread Donn Cave
Quoth Ryan Newton rrnew...@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.