The problem is indeed that the wrong __init_Foo is being passed to
startupHaskell.

The Haskell part of your program consists of two modules, Convert and
ConvertProxy (the latter is generated by H/Direct).  ConvertProxy
imports Convert, and is therefore the "topmost" module in the program.
To fix the GC problems, you must pass __init_ConvertProxy rather than
__initConvert to startupHaskell.

Sorry about the lack of documentation about this, hopefully we'll
rectify that before the next release.

Cheers,
        Simon

> -----Original Message-----
> From: T.J. Brown [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 13, 2001 4:10 PM
> To: Simon Marlow
> Subject: RE: Segmentation fault in program
> 
> 
> I believe I'm passing the correct __init_Foo unless
> I'm confused.  Attached is the code.
> 
> My ultimate goal here is to be able to pass streams of
> data from a C program to a Haskell function for
> processing.  If there is a better way to do this than
> what I'm doing, please let me know. 
> 
> Thanks,
> T.J.
> 
> --- Simon Marlow <[EMAIL PROTECTED]> wrote:
> > GC problems sometimes result from the wrong
> > __init_Foo being passed to
> > startupHaskell.  The symbol you pass in must relate
> > to the topmost
> > module in your program; all other modules must be
> > directly or indirectly
> > imported by the topmost module.
> > 
> > If you're sure this is the case, could you send me
> > the code and I'll
> > take a look.
> > 
> > Cheers,
> >     Simon
> > 
> > > -----Original Message-----
> > > From: Sigbjorn Finne
> > [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, February 12, 2001 8:07 PM
> > > To: T.J. Brown
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: Segmentation fault in program
> > > 
> > > 
> > > I'm able to reproduce this here too -- forwarded
> > > to glasgow-haskell-bugs; I'm no longer involved
> > > debugging GHC bits.
> > > 
> > > --sigbjorn
> > > 
> > > ----- Original Message ----- 
> > > From: "T.J. Brown" <[EMAIL PROTECTED]>
> > > To: "Sigbjorn Finne" <[EMAIL PROTECTED]>
> > > Sent: Monday, February 12, 2001 19:21
> > > Subject: Re: Segmentation fault in program
> > > 
> > > 
> > > > After making the changes suggested below and
> > updating
> > > > the GHC driver script to fix the -no-hs-main
> > bug, my
> > > > program will successfully complete when
> > processing a
> > > > small amount of data.  When processing larger
> > amounts
> > > > of data, however, it will crash with a
> > segmentation
> > > > fault or print "EVACUATED object entered".  If I
> > > > increase the size of the heap with "+RTS
> > -H<size>" the
> > > > program will complete successfully.  It doesn't
> > seem
> > > > like the garbage collector is doing the right
> > thing.
> > > > Is there something I need to do to enable the
> > garbage
> > > > collector to free memory between subsequent
> > calls to
> > > > the my Haskell function (Convert)?
> > > > 
> > > > Thanks,
> > > > T.J.
> > > > --- Sigbjorn Finne <[EMAIL PROTECTED]>
> > wrote:
> > > > > Hi,
> > > > >
> > > > > your converttst.c contains the following decl:
> > > > >
> > > > > extern void startupHaskell (int argc, char*
> > argv[],
> > > > > void* rootMod);
> > > > > void* __init_Main;
> > > > >
> > > > > That won't work, as the root module argument
> > needs
> > > > > to point to
> > > > > something valid. Rewrite it to:
> > > > >
> > > > > extern void startupHaskell (int argc, char*
> > argv[],
> > > > > void* rootMod);
> > > > > extern void* __init_Convert;
> > > > >
> > > > > and substitute __init_Main with __init_Convert
> > > > > wherever it is used
> > > > > in the C code.
> > > > >
> > > > 
> > > > 
> > > >
> > __________________________________________________
> > > > 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
> > > 
> 
> 
> __________________________________________________
> 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