This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Can the Guile library be reentrant




    >> Is there an alternate to "gh_enter" which does some
    >> initialization and then returns, so that the C program can then
    >> re-enter when it needs to do evaluations?

  Tel> gh_eval_str (char *scheme_code)
  Tel> gh_eval_str_with_catch (char *scheme_code, scm_catch_handler_t handler)
  Tel> gh_eval_str_with_standard_handler (char *scheme_code)
  Tel> gh_eval_str_with_stack_saving_handler (char *scheme_code)

  Tel> I think (guess) that these might help... maybe.

Unfortunately not.  You cannot call any gh_ routines until you have
started the interpreter, so you can't just start calling gh_ functions 
anywhere in your program.

I have not yet looked at what the SCWM people did with their versions
of scwm_gh_enter() and all, but that might be an option.

Also, the recent glibc versions should have a call that returns the
top of the stack.  This allows for a gh_init() call to be implemented, 
since the whole reason for the gh_enter() mechanism was to have a
reliable top of the stack for garbage collection purposes.

Such a gh_init() call has not been written, although it is trivial.
The main reasons are that I haven't gotten to it, and that it would
not be portable to systems that do not use glibc.

Sigh: the current approach really sucks, and Guile is (almost) the
only embedded interpreter that does it.