tromey / emacs-ffi

FFI for Emacs
GNU General Public License v3.0
99 stars 18 forks source link

This is an FFI for Emacs. It is based on libffi and relies on the dynamic modules work (available on the Emacs 25 branch) in order to be loaded into Emacs. It is relatively full-featured, but for the time being low-level.

I'd appreciate your feedback, either via email or issues on github.

Types

Currently the library supports primitive and structure types for arguments and return types.

Primitive types are described using keywords:

Structure types are represented by a user-pointer object that wraps an ffi_type. The best way to manipulate structures is to use define-ffi-struct, which is a limited form of cl-defstruct that works on foreign objects directly.

A structure object is also represented by a user-pointer object. If a function's return type is a structure type, then the object allocated by the FFI will automatically be reclaimed by the garbage collector -- there is no need to explicitly free it. (Contrast this with the behavior of ffi-make-c-string, which requires an explicit free.)

Type Conversions

Currently all type conversions work the same in both directions.

Exported Functions

Internal Functions

To-Do List