Hello Alyn,

Thank you for the extra info.

For my sitituation, which is a little different to yours I think, a work
aroundt he issue at the moment by wrapping the scheme-object around a
structure that contains a root node.

I do not know how appropriate or convinient this is to your situation.

...:

typedef struct
{
    void* node;
} Object;

(define make-object
  (foreign-lambda* (c-pointer "Object") ((scheme-object value)) "
    Object* object = malloc(sizeof(Object));
    object->node = CHICKEN_new_gc_root();
    CHICKEN_gc_root_set(object->node, value);
    C_return( object );"))

(define read-object
  (foreign-lambda* scheme-object (((c-pointer "Object") object)) "
    C_return( CHICKEN_gc_root_ref(object->node) );"))
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to