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] |
The documentation on smobs indicates that a new instance is allocated by scm_must_malloc, after which the C program must build a cell with the correct type tag and a pointer to the malloc-ed memory. There is no mention whether an alternate means is allowed. Unfortunately, scm_must_malloc is used all over Guile itself, so we couldn't use it directly to find smobs. There wouldn't seem to be any restriction on using it for other purposes, either. We could try the value-added approach and provide a function defined as SCM *scm_make_instance(long smob_tag, scm_sizet smob_size) that did the allocations and returned the cell pointer already set up. This would let us control where the memory was allocated from. It would have to become the only supported way to allocate a smob instance. I haven't looked at many smobs, but the few I've defined have not kept pointers to scheme objects. It might be helpful if the smob description provided that information. If they don't hold pointers they don't have to be traced except when their header cell is collected. Dale.