Hi
I try to use C-Pointers in Haskell by invoking GreenCard 2.0.
The C-Function I want to use is declared like this:
> %fun listTo :: Int -> [Int] within the Haskell-source and
> int *listTo( int i ) within the C-source
Now, what GreenCard 2.0 makes out of that is the following:
> listTo :: Int -> [Int]
> listTo arg1 =
> unsafePerformIO(
> _casm_ ``do {int arg1;;
> arg1 = %0;
> do {res1 = listTo(arg1);;} while(0);} while(0);'' arg1
> (unmarshall_listLenTypeVar "Int" res1 res2) >>= \ gc_res1 ->
> (return (gc_res1)))
So far, so good. But now GHC 3.01 complains that:
> GHC-C-gc.hs:41: Value not in scope: `unmarshall_listLenTypeVar_'
>
> GHC-C-gc.hs:41: Value not in scope: `res1'
>
> GHC-C-gc.hs:41: Value not in scope: `res2'
The command-line looks like this:
> ghc -fglasgow-exts -fvia-C -fno-prune-tydecls -syslib posix -o
GHC-C GHC-C-gc.hs List.c Add.c StdDIS.o
What is the problem here? GreenCard obviously knows how to handle types
like Int -> [Int], but GHC doesn't. How can I fix that?
Please help!
_____Thomas_____