On Apr 1, 2006, at 21:48, Oleg Parashchenko wrote:
Neil Jerram <[EMAIL PROTECTED]> wrote:
Could you easily rework the program to use scm_boot_guile or
scm_with_guile instead?
No, scm_boot_guile doesn't return, and I can't guess what
scm_with_guile
does. But looking at sources, I found the function
scm_i_init_guile. This
might be exactly what I need, I'll try later.
You call scm_with_guile, and give it a function to call that
manipulates Guile objects or calls Guile functions; it causes the
thread to enter "guile mode", calls the function, leaves "guile mode"
and returns to the caller. (You can also pass a pointer to whatever
associated data you want, so you don't have to make your function
rely on global variables.)
Since it controls entry and exit to your function, its ability to
figure out where the "guile part" of the stack of that thread (needed
for garbage collection) starts is much greater than with
scm_init_guile. If you use scm_init_guile, it needs to figure out
where the thread's stack's base is (yes, this may be easier on some
platforms when configured for null threads), because under that
interface, you could pop back up a few stack frames before invoking
some Guile routines and storing objects into stack slots. Using
scm_with_guile, your automatic variables with SCM objects won't get
stored on the "wrong" side of the stack pointer that scm_with_guile
has recorded.
Ken
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel