[plt-scheme] Plugin-based software

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Fri Jun 2 11:40:02 EDT 2006

On 02/06/06, Robby Findler <robby at cs.uchicago.edu> wrote:
> I think you probably want to have your plugins in modules and
> dynamic-require them, instead of loading them. require (and
> dynamic-require) is (are) designed to avoid exactly these kinds of
> headaches.
>

Dynamic-require seems to work fine but for some reason I keep getting:
compile: variable not provided (directly or indirectly) from module:
mzbrain in: begin

This is the where the problem shows up (the main function in the
mzbrain module):
(define (main configure?)
    (if configure?
        (configure-interface)
        (let* ([default-plugin-option (assoc 'default
(read-option-file (get-option-file-path)))]
               [plugin (if (and default-plugin-option (second
default-plugin-option))
                           (dynamic-require (string->path
(string-append (get-plugin-path) (second default-plugin-option)))
                                            'plugin)
                           (begin
                             (message-box "No default plugin" "You
have not set yet a default plugin. Use configure window.")
                             (exit)))]
               [game (compound-unit/sig
                       (import)
                       (link (PLUGIN : mzbrain-plugin^ (plugin))
                             (MZBRAIN : mzbrain^ (mzbrain@ PLUGIN)))
                       (export (var (MZBRAIN show-interface))))])
          (invoke-unit/sig game))))

Although the highlight occurs in the dynamic-require message, I ask
myself if the problem is with the begin in the line after
dynamic-require.

Any ideas?

> Robby
>
> At Fri, 2 Jun 2006 16:13:14 +0100, "Paulo J. Matos" wrote:
> > Hi all,
> >
> > I'm trying to implement a simple plugin-based software. My first
> > approach which quite didn't was to define a plugin as a plain scheme
> > file where the last expression was a unit which imported a given
> > signature. Then I have a master file which loads the plugin with
> > 'load', composes the plugin unit with another main unit and invokes
> > what it needs. Seems ok at first but the problem is that the plugin
> > may require some lib functions so it start with a couple of
> > 'require's. For some reason it runs ok inside DrScheme, but when I
> > compile the main program and run it, it tries to load the plugin and
> > then I get an error message along the lines:
> > Couldn't find collection "srfi" in HOME/.plt-scheme... etc etc.
> >
> > Oh, well, so I though I should compile it. I did so using the
> > compile-file and the I used 'load' again and load returns:
> > compile: variable not provided (directly or indirectly) from module:
> > mzbrain in: begin
> >
> > well, can't understand this. mzbrain is the main module. I'm just
> > trying to load a files primefactor.pss.zo. Can't understand it's
> > problem. Any guesses?
> >
> > --
> > Paulo Jorge Matos - pocm at sat inesc-id pt
> > Web: http://sat.inesc-id.pt/~pocm
> > Computer and Software Engineering
> > INESC-ID - SAT Group
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


-- 
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group


Posted on the users mailing list.