[Haskell-cafe] Re: different code in different platforms

John Meacham john at repetae.net
Wed Mar 15 20:37:33 EST 2006


On Wed, Mar 15, 2006 at 04:13:19PM +0000, Simon Marlow wrote:
> There's a lot to be said for using runtime tests instead of conditional 
> compilation, I agree.  However, it can't be used exclusively: you can't 
> choose between two foreign calls this way, for example, because one of 
> the calls won't link.

A scheme I was considering for jhc was to (optionally) replace any foreign calls that
don't link with 'error', a solution for ghc might be to include stub
functions with the 'weak' attribute set in the object file for any
potentially non-existing functions. then the system versions will
override them if they exist, otherwise the stub functions will be
called.

perhaps there is room for a FFI extension there? allowing 'weak' to be
specified on FFI imports that means 'don't complain if the system
doesn't provide this function'

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list