[asdf-devel] loading platform-dependent code

Stelian Ionescu sionescu at cddr.org
Sun Jan 24 20:26:23 UTC 2010


On Sun, 2010-01-24 at 21:02 +0100, Tamas Papp wrote:
> Hi,
> 
> I am the author of the cl-cairo2 library.  Cairo itself is a graphics
> library, and my library provides a Lisp interface.
> 
> Some of the features (eg drawing in X11, Windows or Quartz) are
> platform dependent.  Currently, the approach of cl-cairo2 is to
> provide extra system definitions for these, eg an X11 user would load
> the systems cl-cairo2 and cl-cairo2-x11 manually.  I am wondering if
> there is a better way to do platform-dependent loading.
> 
> The solution I was thinking of was to try loading the platform
> dependent shared C libraries using CFFI, and set some flag (or push
> something to *features*) if they succeed, but if they fail, capture
> the condition with handler-case and just proceed with a warning.  Then
> I could load platform-dependent code conditionally on this --- but I
> don't know how to do that in ASDF.
> 
> Please tell me what is the "right way" to do these things (ie stuff
> that I put in features).  Examples of libraries that load
> platform-dependent code conditionally with ASDF would also help.

I'd suggest something like this: rename cl-cairo2 to cl-cairo2-base,
make cl-cairo2-{mac,win,x11} depend on cl-cairo2-base and add an empty
system cl-cairo2 that
:depends-on (#+darwin :cl-cairo2-mac
             #+windows :cl-cairo2-win
             #+(and unix (not darwin)) :cl-cairo2-x11)

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
http://common-lisp.net/project/iolib
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20100124/af30966a/attachment.sig>


More information about the asdf-devel mailing list