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: Guile, C, and Garbage Collection


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> SCM
> scm_make_foo ()
> {
>   SCM z;
>   char *foo = scm_must_malloc (sizeof (struct foo), s_make_foo);

Oops!  Need to set foo->bar to some valid scheme value here:

  struct foo *foo = (struct foo *) scm_must_malloc (...);
  foo->bar = SCM_BOOL_F;

>   SCM_NEWCELL (z);
>   SCM_DEFER_INTS;
>   SCM_SETCDR (z, foo);
>   SCM_SETCAR (z, foo_type);
>   SCM_ALLOW_INTS;
>   return z;
> }

/mdj