{"id":13803666,"url":"https://github.com/cffi/cffi","last_synced_at":"2026-03-15T13:29:11.124Z","repository":{"id":1121618,"uuid":"1785257","full_name":"cffi/cffi","owner":"cffi","description":"The Common Foreign Function Interface","archived":false,"fork":false,"pushed_at":"2025-03-11T13:07:11.000Z","size":2825,"stargazers_count":452,"open_issues_count":168,"forks_count":136,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-03-11T14:23:02.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://common-lisp.net/project/cffi","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cffi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-05-22T21:15:04.000Z","updated_at":"2025-03-11T13:07:15.000Z","dependencies_parsed_at":"2024-03-08T14:49:43.618Z","dependency_job_id":"79544234-bc94-4840-896c-bafb98ab502c","html_url":"https://github.com/cffi/cffi","commit_stats":{"total_commits":1219,"total_committers":103,"mean_commits":11.83495145631068,"dds":0.5643970467596391,"last_synced_commit":"33970351e71bb5f12ba56fc40270089e948ae112"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cffi%2Fcffi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cffi%2Fcffi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cffi%2Fcffi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cffi%2Fcffi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cffi","download_url":"https://codeload.github.com/cffi/cffi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981894,"owners_count":21994351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:00:36.750Z","updated_at":"2025-12-18T05:39:09.101Z","avatar_url":"https://github.com/cffi.png","language":"Common Lisp","readme":"[![Build Status](https://travis-ci.org/cffi/cffi.svg?branch=master)](https://travis-ci.org/cffi/cffi)\n\n# What\n\nCFFI, the Common Foreign Function Interface, purports\nto be a portable FFI for Common Lisp. It abstracts away the\ndifferences between the API of the native FFI's of the various Common\nLisp implementations.\n\n# How\n\nThe CFFI library is composed of a Lisp-implementation-specific backend\nin the CFFI-SYS package, and a portable frontend in the CFFI package.\n\nThe CFFI-SYS backend package defines a low-level interface to the\nnative FFI support in the Lisp implementation. It offers operators for\nallocating and dereferencing foreign memory, calling foreign\nfunctions, and loading shared libraries.\n\nThe CFFI frontend provides a more comfortable, declarative interface\nfor defining foreign functions, structures, typedefs, enumerated\ntypes, etc. It is implemented in portable ANSI CL making use of the\nlow-level operators exported by CFFI-SYS.\n\nThe CFFI-LIBFFI subsystem loads support for passing structs by\nvalue. It requires [libffi](https://sourceware.org/libffi/) for that.\n\nPlease consult [the\nmanual](http://common-lisp.net/project/cffi/manual/html_node/) for\nfurther details, including installation instructions.\n\n# Where\n\nPlease visit [Github](https://github.com/cffi/cffi/issues) for bug\nreports, feature suggestions, the latest version, and to send your\ncontributions. CFFI also has a [mailing\nlist](https://mailman.common-lisp.net/listinfo/cffi-devel), and a\nproject page at [cffi.common-lisp.dev](https://cffi.common-lisp.dev/).\n\n# Notes\n\n### CFFI/C2FFI\n\nCFFI/C2FFI is an ASDF-integrated mechanism to automatically generate a\ncomplete CFFI binding from C header files.\n\nIts input is one `.h` file (with possible `#include`s of course), and\nits final output is a lisp file with the relevant CFFI binding forms.\n\nIt requires a CLI tool called [c2ffi](https://github.com/rpav/c2ffi),\nbut only for the developers of the C binding libraries, not their\nusers. `c2ffi` is written in C++, and it uses Clang as a library to\nparse the C code, and emit the result as JSON. To skip this step,\nthese host-specific JSON files can be checked into the repos of the\nbinding libraries. This breaks the dependence on a working c2ffi\nbinary and the C header files, which can be a hurdle.\n\nThese JSON files are then used to automatically generate a CL file\nwith the corresponding CFFI forms. The generated bindings mirror the C\nnamespace into an empty CL package as closely as possible. This means\nthat the upper/lower case of the C names are retained. It helps with\nreading the original docs and with rewriting C examples into\nlisp. `#define`s are also mirrored as CL `defconstant`s.\n\nBinding library developers are advised to introduce another package on\ntop of this raw layer to add more lispy constructs where appropriate\n(e.g. `with-` macros that manage resources, etc).\n\nUntil CFFI/C2FFI is properly documented, you may check out these\nprojects as examples:\n[hu.dwim.zlib](https://github.com/hu-dwim/hu.dwim.zlib),\n[hu.dwim.sdl](https://github.com/hu-dwim/hu.dwim.sdl),\n[hu.dwim.bluez](https://github.com/hu-dwim/hu.dwim.bluez), and\n[hu.dwim.mosquitto](https://github.com/attila-lendvai/hu.dwim.mosquitto).\n\n### Related projects\n\n- [cl-autowrap](https://github.com/rpav/cl-autowrap) is another\n  project that uses `c2ffi` to generate CFFI bindings.\n","funding_links":[],"categories":["C ##"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcffi%2Fcffi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcffi%2Fcffi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcffi%2Fcffi/lists"}