This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Garbage collection and C structures


On Sat, Mar 20, 1999 at 11:16:57AM -0500, Daniel Burrows was heard to say:
>   Hi.  I'm using Guile in a C program.  I've been having mysterious segfaults
> recently that seemed to be occuring in the garbage collector.  I think that I've
> finally worked out what the problem is; I had a heap-allocated variable that
> contained a char* pointer which I wanted to return to Scheme; to do so, I
> did:
> 
>   return gh_str02scm( data->string );
> 
>   With this code, my program would periodically segfault.  When I changed this
> line to:
> 
>   return gh_str02scm( strdup( data->string ) );
> 

  Ick.  The problem _didn't_ go away, it just looked like it did. :-)

  So now I'm completely confused.  Are there any other things that could
possibly be going wrong?

  Daniel

-- 
  Fate always wins...at least, when people stick to the rules.

             -- Terry Pratchett, _Interesting Times_