Sorry to take so long to get around to this, but I finally have. I used
Simon's modified version of your code (passing __init_ConvertProxy
rather than __init_Convert as the third argument to startupHaskell), and
it works fine, on large files with large and small buffers. Did you have
particular test data for which it failed?

[Sigbjorn has since sent me such data, which still work fine for me.]

-----Original Message-----
From: T.J. Brown [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 08, 2001 11:06 PM
To: [EMAIL PROTECTED]
Subject: Segmentation fault in program


Hi,

I'm trying to write a program (in C) that calls a
function that is implemented in Haskell.  The inputs
to the function is: a pointer to a buffer of unsigned
longs, the length of the input buffer, and a pointer
to a buffer of unsigned chars.  The function is to
convert the buffer of unsigned longs into a [Word32],
then convert that list into [Word8] (there will be
some sort of processing on this list eventually) and
then copy it to the output buffer.  I'm using
HaskellDirect to assist with this interface between C
and Haskell.  The problem I'm seeing is that depending
on the size of the buffer, the program segmentation
faults.  I don't see any obvious reason that this is
happening so I'm wondering if something isn't going
wrong during the compilation.

System info:
linux 2.2.12-20
gcc version: egcs-2.91.66

Attached are the source files and the compile output.

Also, is there a better way of passing a buffer
between C and Haskell?  For instance, is there a way
to convert the buffer into a list automatically?

Thanks for your help,
T.J.

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

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

Reply via email to