Hi, there
   I am using Greencard with Hask's foreign function export. I found
the following program can cause seg-fault. Anyone has any idea? BTW,
if I replace greencard with Hask's foreign function import, there
is no such error.

in ABC.gc:

foreign export ccall "h_add" h_add :: Int -> IO Int
h_add a = do
    putStrLn "in haskell callback"
    return (a + 1)

%fun add ::  Int -> IO(Int)
%call (int a)
%code int r;
%     r = c_add (a);
%result (int r)

and the result is like:

in c callback
in haskell callback
Segmentation Fault




in add.c:

_RESULT c_add(int a) {
    printf("in c callback\n");
    return h_add(a);
}


TIA!

------
chenyu
in Main.hs:

main = do
    a <- add 127
    putStrLn (show a)

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to