Again: FFI Syntax

Sven Panne Sven_Panne at BetaResearch.de
Mon May 14 07:04:41 EDT 2001


Simon Peyton-Jones wrote:
> [...] I'd go for automatically adding quotes.  Acutally, I'd automatically
> add a '.h' too.  Reason: you are really specifying the assembly or package
> where the function comes from, and that might be useful for linking as
> well as includes.   If the package was called P, the compiler can
> #include "P.h", and in addition say -lP on its link command.  That's less
> convenient if there's a .h to strip off.

Hmmm, this looks like mixing concepts again. I thought we agreed on the fact
that the include part specifies an #include, and nothing else. For "real"
stuff things aren't that easy anyway: Include files for larger libraries live
in subdirectories (e.g. <GL/gl.h>, <readline/readline.h>), linking a single
additional library is seldom enough (e.g. you normally need to link with
termcap,too, when you link with (n)curses, linking an X app needs almost a
dozen libs on some platforms, etc.), ...

So let's simply say: The contents of the include part of extent are implictly
wrapped into double quotes iff they don't start with '<' or '"', and no ".h"
is appended. Easy rule, doesn't mix concepts, and is readable:

    foreign import ccall "static !myproc myinclude.h" myProc :: ...

Cheers,
   Sven
-- 
Sven Panne    Fon: +49/89/99567000    Fax: +49/89/99567461
BetaResearch GmbH,    Betastr. 1,    D-85774 Unterfoehring
mailto:Sven_Panne at BetaResearch.de    http://www.betaresearch.de




More information about the FFI mailing list