[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] schemish/chickenish way to make configurable executa

From: Matt Welland
Subject: Re: [Chicken-users] schemish/chickenish way to make configurable executables?
Date: Sun, 3 Nov 2013 08:56:47 -0700

Hi Peter,

It looks like cond-expand does enough to achieve what I want. Thanks!


On Sun, Nov 3, 2013 at 2:58 AM, Peter Bex <address@hidden> wrote:
On Sat, Nov 02, 2013 at 11:35:22PM -0700, Matt Welland wrote:
> I'm curious to hear opinions on conditional complication and configuration
> using Chicken scheme.
> Say for example I want to enable or disable the use of a particular library
> or feature and I want there to be no trace of it in the executable.
> I can use a preprocessor such as cpp but I imagine there is a better way.
> Any strategies or methodologies you all can share? Are macros good for this?

Hi Matt,

Usually when I want to do something like this, I use cond-expand and
provide the feature via -feature provide-foo:

(define (foo)
    (provide-foo (do-whatever-foo-does))
    (else (error "support for foo is disabled"))))

This is used extensively by the "crypt" egg to select which
fallback implementations need to be provided and for which
implementations it can use the one provided by libc.

This is of course only available when compiling from Scheme.
If you want to ship precompiled C files (so you'll only need
a C compiler and libchicken), you'd have to use C preprocessor
and/or conditional compilation of various different implementation
files through Make like CHICKEN itself does (for posixunix/posixwin,
and for things like HAVE_POSIX_POLL).  This is a lot trickier to
do right, and I wouldn't recommend it unless you really have to.


90% of the nations wealth is held by 2% of the people. Bummer to be in the majority...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]