[CM] c_objects and garbage collection: s7_make_c_object_without_gc ?

Christos Vagias chris.actondev at gmail.com
Wed Apr 7 14:40:09 PDT 2021


Hi Bil,

I have some c_objects that I'm creating with s7_make_c_object.
I can read, write etc, and having set the s7_c_type_set_free the allocated
memory will be freed when the object is no longer used by s7.
So far so good.

I've stumbled upon the scenario where I would like to use the getters & setters
on some c data that is handled by someone else (ie I'm not the one
creating it, or it's allocated on the stack and should not be freed)
and thus should not be freed by s7's garbage collector.

What do you think about s7_make_c_object_without_gc ?
>From what I see in the code I'd be the same without calling add_c_object(sc, x);

The currently available alternative is to create a complete new
c_object type, skip the "s7_c_type_set_free" and duplicate all the
rest (getters, setters etc)


More information about the Cmdist mailing list