[plt-scheme] abusing modules

From: Pedro Pinto (ppinto at cs.cmu.edu)
Date: Mon May 5 21:06:27 EDT 2003

Hi there,

I have been trying to coerce MzScheme's module system into allowing
the importing of .NET assemblies. So far I managed to do this:

(module test

  ; this `require' installs a module name resolver which will look 
  ; for module specs of the form (assembly <name>) and invoke
  ; a C++ extension to import the assembly
  (require (lib "dotnet.ss" "dotnet"))
  ; this will end up invoking a C++ extension which will
  ; do something similar to this:
  ; Scheme_Env *env = 
  ;	scheme_primitive_module(<moduleName>, 
  ; 			        scheme_get_env(scheme_config));
  ; scheme_add_global ("dot-net-symbol-1", 
  ;                    a_scheme_obj_1,
  ;                    env);
  ; ...
  ; scheme_finish_primitive_module(env);
  (require (assembly "mscorlib")))

This works if `test' is define and required at the top level. However
`(require "test")' results in an error:

require: unknown module: <module-name> 

Any ideas as to why? I realize that this is a bit of an abuse of the
module system but I am somewhat infatuated with the cleanness of the

Thanks in advance,

Posted on the users mailing list.