This is a completely tentative patch, bceause I'm still not
quite clear on the interactions of bindings, GCPRO,
unwind-protect and the like in the C layer. I *think* it's
pointless to specbind() DEFVAR_LISPed variables, because it
seems to me that this would break the magic link between the
C variable and the Lisp symbol --- the magic forwarding
symbol would wind up on the specbinding stack --- and the C
code uses the variable... so I've tried to
record_unwind_protect it instead. I'm not quite sure if I've
done it right, or if I need to GCPRO something (I don't think
so: stuff on the specbinding stack and stuff in DEFVAR_LISPed
variables are both found by the garbage collector anyway,
right?) record_unwind_protect()?)
It compiles, I don't know if it runs, I don't know if it's
safe
Yes.
I don't know if there's a better way to do it:
Yes.
record_unwind_protect() and specbind() (of a Q... Symbol that names the
variable) are both fine. Easiest/best is internal_bind_lisp_object().