Modification to foreign import/export

Alastair Reid reid at
Wed Feb 21 13:41:07 EST 2001

> "Alastair Reid" <reid at> wrote,
> > Marcin wrote:
> > > This has the advantage that when the library name is #ifdefed, the
> > > conditional needs not to be repeated for each function. Similarly
> > > for #included header names.
> >
> > Note that this can be done without separating the library name from the ffi
> > decl:
> > [...]
> That's not a solution, because cpp is not part of Haskell.
> I think, it is a good idea to make things cpp-friendly where
> we can, but we must not rely on cpp to solve any problem.

The point of me mail was that instead of using half the features of cpp (Marcin
gave an example which used #ifdef) and extending the ffi spec to do the other
half, he could use all the features of cpp (#ifdef and #define) and avoid the
ffi extension.

If we want to rule cpp as out of bounds (a very worthwhile but difficult goal),
then we need to think about how to avoid conditional compilation too.
(SimonM's mail this morning about not putting library names in source code
seems to be part of this story.)


More information about the FFI mailing list