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?
> 
> 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.

Until GNU Libc 2 is rightfully and justly adopted as the Universal
Standard, perhaps a gh_broken_libc_init() could be implemented which
takes the top-of-stack pointer as an argument.  Then it's the
application's responsibility to pass a reasonable value.

Come to think of it, this could be beneficial if the application knows
it won't store SCMs above point x in the call stack.  Why scan above a
frame which both initializes and destroys the interpreter?

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

It even seems hard to call Guile "embedded" when it must control
main().