Design

Overview

UFFI was designed as a cross-implementation compatible Foreign Function Interface. Necessarily, only a common subset of functionality can be provided. Likewise, not every optimization for that a specific implementation provides can be supported. Wherever possible, though, implementation-specific optimizations are invoked.

Priorities

The design of UFFI is dictated by the order of these priorities:

  • Code using UFFI must operate correctly on all supported implementations.

  • Take advantage of implementation-specific optimizations. Ideally, there will not a situation where an implementation-specific FFI will be chosen due to lack of optimizations in UFFI.

  • Provide a simple interface to developers using UFFI. This priority is quite a bit lower than the above priorities. This lower priority is manifest by programmers having to pass types in pointer and array dereferencing, needing to use cstring wrapper functions, and the use of ensure-char-character and ensure-char-integer functions. My hope is that the developer inconvenience will be outweighed by the generation of optimized code that is cross-implementation compatible.