From: Dave B. <da...@ta...> - 2001-09-20 08:22:24
|
At 13:27 18/09/2001, Robert Harper wrote: >3. Standardization of a foreign function interface. I have not thought very >much about this issue, but I can certainly see difficulties with >compatibility not only across implementations (the various compilers out >there), but also across platforms (primarily, Unix vs Windows). Fundamental >issues such as the semantics of "int" will arise, since implementations >differ, even on the same hardware and software platform, and since external >code will impose its own requirements. The need for an FFI is largely >pragmatic --- we cannot re-invent the world ourselves in our own way. >However, as someone pointed out, buying into foreign code will certainly >limit portability across platforms and quite possibly across >implementations. I think it's quite the reverse. At present, it is virtually impossible to write a portable library that interfaces to C. With a standard FLI, it will be possible. Of course it will remain possible for people to write non-portable code, but it will also be possible to write portable code. Platform differences are always present when writing libraries. If one platform uses 64-bit ints and another uses 16-bit ints, you either have to ignore it (if it isn't relevant), accept it, or work your way around it. That doesn't stop many libraries being useful on a wide variety of platforms. Portability is always a matter of "how many platforms" rather than "all or none". In any case, portability isn't always what you want. If I write an library for accessing the registry, the Unix users out there won't care. Access to platform-specific libraries is just as important as writing portable libraries. Dave. |