Subject: Re: plugins and lisp From: Erik Naggum <email@example.com> Date: 02 Feb 2004 21:35:12 +0000 Newsgroups: comp.lang.lisp Message-ID: <2004-033-855-KL2065E@naggum.no> * Pieter | How will a plugin type thing work on lisp? The usual issues, loading binary code and making it possible for it to call already loaded code, are trivial. The loading and linking phases of Common Lisp environments are entirely transparent. However, you need to think about how you wish to «register» your code so that the system can call it. One common way to do this is via hook variables -- lists of functions to call with no arguments and only for effect at known points in the code. Another common way is to use CLOS methods with :BEFORE, :AROUND, and :AFTER qualifiers. You need to plan for either way. Other ways are possible, such as replacing a function entirely, but then it may be difficult to load more than one plugin that does this, even if you store the old definition in some variable and call it at the appropriate time. | In c++ I would make a nice base class with a bunch of pure virtuals. | The .so or .dll will return a pointer to an instance of the base class | and so the story goes. Is the approach in Lisp similar? Generally, no, but you could certainly arrange for something like it. -- Erik Naggum | Oslo, Norway 2004-033 Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.