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: Missing standard functions


On Wed, 26 Aug 1998, Ralf Schmelter wrote:

> I have encountered a problem while I was writing an extension to Guile.
> The problem is, that I cannot use certainn functions (load for example)
> because the interpreter exits with an error ('guile: Unbound variable:
> load' in this case). This does not happen, if I run guile interactively. I
> start the interpreter in my program with the gh_enter function and most
> of the functions (define, let, etc.) work properly. Another problem is,

I have run into the same problem a while ago. There is a guile startup
script named boot-9.scm which is not executed by gh_enter. The solution is 
to execute (primitive-load-path "ice-9/boot-9.scm") before you do anything
else.

The next problem is that boot-9.scm may only be executed once, otherwise
you get a stack overflow. When entering the read-eval-print-loop (repl)
with gh_repl, guile loads boot-9.scm. Thus, if you did load boot-9.scm
yourself and then later enter the repl, guile will abort with a stack
overflow.

If you look a little into the guile mailing list archives, you can find a
temporary solution to the problem which I posted quite some time ago. It's
a trivial fix: 
1) rename boot-9.scm into boot-9-tail.scm
2) create a new boot-9.scm, which only contains the following code:

(if (not (defined? 'provide))
    (primitive-load-path "ice-9/boot-9-tail.scm"))

With this modification, boot-9.scm can be read several times.


Note to the maintainers:

* The documentation on gh_enter in gh.texi is inaccurate:
> @deftypefun void gh_enter (int @var{argc}, char *@var{argv}[], void (*@var{main_prog})())
> Starts up a Scheme interpreter with all the standard packages.

Best regards, 
Dirk Herrmann