[plt-scheme] Accessing modules from C extensions?

From: Keith Frost (keithf at amnis.com)
Date: Wed Sep 25 17:30:40 EDT 2002

In a C extension, I have the following code in scheme_reload:

    blah = scheme_lookup_global(scheme_intern_symbol("foo"), env);

where blah is a static variable used by the extension to access function 
foo.
This works, as long as foo is in fact a global.

But if foo is declared in a module bar, then I find I must declare

(define foo (dynamic-require "bar.ss" 'foo))         ;before
(load-extension ...)  ; because
(require "bar.ss")    ; is not sufficient to give my C extension access 
to the
relevant namespace.  My question: is this the *only* way to do this, or 
am I
missing some other way of accessing the function I need?

To put it another way:  the example distributed with the source code shows
how to create a C extension which provides a module.  Excellent.  Is 
there a
way, from C, to perform the equivalent (require ...) declarations in the 
module,
and then read provided objects from the required modules?




Posted on the users mailing list.