Generating Function Prototypes

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Jul 3 11:43:58 EDT 2002


Alastair Reid <reid at reid-consulting-uk.ltd.uk> writes:

> Shouldn't we encourage people to use the compiler-independent
> mechanism instead (and exclusively)?

Yes, you are right.  I'm all in favour of standard mechanisms.

> That is, you put all your flags, includes, prototypes, etc. into a 
> header file, ... and then mention foo.h in all relevant foreign imports:
> 
>     foreign import "foo.h" x :: ...

Yup, this approach is the most platform-independent we managed to
come up with.  Now I just need to catch up with ghc and Hugs by
implementing it in nhc98...

> They still have to use compiler-specific mechanisms to specify
> #include search paths, linker options, etc.

Indeed, but these things are not only compiler-specific, they are
also often OS-specific, so it is right that they should not be in
the program source.

Regards,
    Malcolm



More information about the FFI mailing list