Michael Hobbs <[EMAIL PROTECTED]> writes:
>
> When I nest a performIO inside another, I get a segmentation fault.
> What I'm doing is invoking a C function which invokes a callback
> to Haskell via performIO(). This callbacked function in Haskell
> then calls a C function which invokes another performIO() function.
> At the point of the second performIO() I get seg faults, bus errors,
> and/or core dumps (take your pick). I'm using GHC 3.02 on Linux i386.
> (RedHat 5.1, to be exact)
>
Hi,
if the first performIO() invocation happens to exit the Haskell world
before the second does, then you're seeing a bug/shortcoming in the
C-calling-Haskell interface (which is fixed in the RTS that comes
with ghc-4.00).
If not, then make sure that you use _ccall_GC_ when invoking the C
functions that (eventually) invoke performIO(). If that doesn't help
either, it's probably worth your while getting ghc-3.03 (via the
ghc-current snapshots), since it has a performIO() bug fix (RetReg
was not being saved across a performIO() invocation, something which
will bite you on platforms where RetReg is not in a machine register
(e.g., x86.))
Let me know what happens,
--Sigbjorn