cpp

Manuel M. T. Chakravarty chak at cse.unsw.edu.au
Fri Feb 23 02:20:41 EST 2001


"Alastair Reid" <reid at cs.utah.edu> wrote,

> While on the subject of preprocessors, I thought I'd mention a need I've found
> in distributing tools like Knit where the intended audience isn't expected to:
> 
> 1) Care either way about it being implemented in Haskell
> 
> 2) Have any desire to spend half a day installing lots of Haskell-related tools
>    (greencard, c2hs, happy, etc.) on their machine before they can try out my
> tool.
>    Getting them to install a GHC binary is about the limit of what I can
> reasonably
>    expect.
> 
> In this case, it is very useful to be able to distribute the output of all
> those useful support tools (greencard, c2hs, happy, etc.).
> 
> But now the problem: if I achieve portability by running the input to these
> tools through cpp (or any other tool providing conditional compilation), then I
> end up with 2^N different files to distribute and complicated instructions for
> building the system.

Yes, a nasty problem.

> What would (perhaps) be nice is for the support tools to implement conditional
> compilation themselves and for the output file to use conditional compilation
> too.

Due to my dislike of mixing cpp and Haskell, c2hs actually
doesn't use conditional compilation at all.  I gather some
information with autoconf, but much of this won't be
necessary with the latest version of the FFI libraries.  So,
it might actually be feasible to delay the inclusion of
system dependent information until the generated files are
compiled, which is what you want.

Good point - I will put it on the todo list.

Cheers,
Manuel




More information about the FFI mailing list