Changes between Version 3 and Version 4 of ForeignFunctionInterface


Ignore:
Timestamp:
Dec 6, 2005 12:43:48 PM (10 years ago)
Author:
john@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ForeignFunctionInterface

    v3 v4  
    2222    * It is true that by giving inaccurate `foreign import`s one can define `unsafePerformIO`, but that doesn't mean it should be standard. 
    2323    * The stated purpose of `unsafePerformIO` in the FFI (hiding marshalling and unmarshalling for otherwise pure functions) can be achieved with a `runST`-like device if the language has [wiki:Rank2Types] or [wiki:RankNTypes]. 
    24  * Foreign imports may specify a single include file. This is sufficient in theory, but most GHC users prefer to use `-#include` options instead, and the standard form is poorly supported by GHC. The hierarchical libraries use an `INCLUDE` pragma as a portable replacement for `OPTIONS_GHC -#include`. 
     24 * Foreign imports may specify a single include file. This is sufficient in theory, but most GHC users prefer to use `-#include` options instead, and the standard form is poorly supported by GHC. The hierarchical libraries use an `INCLUDE` pragma as a portable replacement for `OPTIONS_GHC -#include`. jhc lazily collects the imports needed and only includes the ones needed by the FFI functions used after optimizations. this means you can have FFI calls refering to libraries and includes that are not on a system and still compile the program if none of the routines are used.  
    2525 * Cross-platform libraries (e.g. HOpenGL) often want to import the same foreign functions using the `ccall` convention on Unix and the `stdcall` convention on Windows. The usual method is to use CPP hackery. 
    2626 * The specified CString conversions are not yet supported in the hierarchical libraries. 
     27 * jhc allows libraries to be specified as well as include files. this is handy for its lazy linking, the syntax is "-lfoo include.h foo_func"