[plt-scheme] doing without load-extension

From: Dave Griffiths (dave at pawfal.org)
Date: Thu Nov 15 18:42:01 EST 2007

On Thu, 2007-11-15 at 15:37 -0700, Matthew Flatt wrote:
> At Thu, 15 Nov 2007 22:12:46 +0000, Dave Griffiths wrote:
> > Is it possible to write modules which use extensions but don't need to
> > have load-extension called before they are require'd?
> > 
> > For example, I'm currently having to do something like this:
> > 
> > (load-extension "path/to/my-extension.so")
> > 
> > (module my-module mzscheme
> >    (require my-extension-namespace)
> >    ...
> > )
> 
> The key is to put the extension in a place where it is found as an
> alternative to Scheme source.
> 
> For example, you could put it in
> 
>   (build-path "compiled" (system-library-subpath) "my-extension.so")
> 
> relative to "my-module.ss", and then change "my-module.ss" to
> 
>  (module my-module mzscheme
>    (require "my-extension.ss")
>    ...)
> 
> then when the module loader looks for "my-extension.ss", it will pick
> up "my-extension.so", instead.
> 
> If you're using v3.99 instead of v371.3 or earlier, then name the file
> "my-extension_ss.so" (i.e, with an extra "_ss").

Ah, that's better - and much simpler than I was thinking.

Thanks!

dave




Posted on the users mailing list.