[gambit-list] calling interpreted scheme code from compiled C

Marc Feeley feeley at iro.umontreal.ca
Tue Jan 20 09:31:36 EST 2009


On 20-Jan-09, at 1:32 AM, James Long wrote:

> The warning is just a warning.  It's a common message from Gambit  
> when dynamically loading libraries.  The issue is that when a  
> library is loaded, it references a few functions which don't exist  
> yet.  Most likely these requirements will fulfilled by loading other  
> libraries which define those functions.  For example:
>
> ;;test.scm
> (c-define (foo) () void "foo" ""
>     (bar))
>
> ;;test2.scm
> (define (bar)
>     (display "hello"))
>
> % gsc test.scm
> % gsi
> Gambit v4.3.2
>
> > (load "test")
> *** WARNING -- Variable "bar" used in module "test.o1" is undefined
> "~/test.o1"
> > (load "test2")
> "~/test2.scm"
> > (foo)
> hello>
>
> So it's probably just a timing issue.  You could add `(load "test")'  
> at the top of wrapper.scm and compile wrapper.scm, and then run `gsi  
> wrapper.o1' instead.
>

That's correct.  To avoid these warnings you can:

1) Load the files in reverse dependency order (i.e. load test2.scm  
before test.o1).  This can also be done on the command line with:

     gsi test2 test

2) Use the procedure "load-quietly" which you can define and use like  
this:

(define (load-quietly path)
   (##load path
           (lambda (script-line script-path) #f)
           #t
           #t
           #t))

(load-quietly "test")
(load-quietly "test2")

Marc




More information about the Gambit-list mailing list