This is the mail archive of the
mailing list for the Guile project.
Re: New smob interface
Greg Harvey writes:
> Mikael Djurfeldt <firstname.lastname@example.org> writes:
> > But, we never told it that sizeof (WINDOW) bytes was allocate in the
> > first place! This is normally handled inside scm_must_malloc. (All
> > Guile objects have their storage allocated using that call.)
> Here you should use scm_done_malloc. There should also be a
> scm_done_free call, so that you don't have to return the size freed to
> the gc, which can be unwieldy if you have a large, dynamic
> structure (I think it's a bit gross, anyway ;).
Where should those routines be placed? Immediately after the function
that allocates/frees a struct which gets wrapped into a smob returns?
Before or after a gh_allow_ints()? (If it really makes sense to call
I just noticed , in addition, that my SCM2WINDOW does not even check
whether the smob is of the correct type, and that should be done as
soon as possible , similar as in the old implementation , where one
checked the CAR of the object's cell against the tag of the smob type.
How would one do that under the new interface?