Ross Paterson <[EMAIL PROTECTED]> writes:
> > Modified files:
> > libraries/base/Text/Regex Posix.hsc
> > Log:
> > Fix regex.h include stuff; Ross and Malcolm might want to look at the
> > new comment
>
> The "hacky solution" is the only way offered by the FFI spec to specify
> the include for foreign imports. I gave up on that limitation some
> time ago, and made the Hugs build system extract the -#include options
> from GHC OPTIONS pragmas. I think it would be better to have a less
> compiler-specific equivalent, though. An INCLUDE pragma?
The "correct" solution, blessed by the FFI addendum, is for all
such platform-specific configuration to be done outside Haskell,
incorporated into a single .h file that is named in the foreign import.
For instance, here for regexes, the simplest solution is to prepend
to libraries/base/include/regex/regex.h the following few lines:
#ifdef __GLASGOW_HASKELL__
#include "ghcconfig.h"
#endif
#if HAVE_REGEX_H && HAVE_REGCOMP
#include <regex.h>
#define _REGEX_H_
... and then a simple
foreign import ccall unsafe "regex/regex.h regexec" :: ....
is correct for all environments.
Regards,
Malcolm
_______________________________________________
Cvs-libraries mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-libraries