Since Guile 2.0, which switched to BDW-GC, scm_protects has been mostly
irrelevant because BDW-GC scans all the C global variables.

Actually, libguile/gc.c in 2.0 reads this:

--8<---------------cut here---------------start------------->8---
#if SCM_ENABLE_DEPRECATED == 1
/* Hash table that keeps a reference to objects the user wants to protect from
   garbage collection.  It could arguably be private but applications have come
   to rely on it (e.g., Lilypond 2.13.9).  */
SCM scm_protects;
#else
static SCM scm_protects;
#endif
--8<---------------cut here---------------end--------------->8---

So the alternative to scm_protects should be just something like this:

  static SCM my_protects;

    ...
    my_protects = scm_cons (obj, my_protects); /* or a hash table */

Would it work for LilyPond?

Ludo’.

Reply via email to