{"id":13803737,"url":"https://github.com/sdilts/cl-bindgen","last_synced_at":"2026-01-31T06:04:22.269Z","repository":{"id":54827054,"uuid":"238324557","full_name":"sdilts/cl-bindgen","owner":"sdilts","description":"A command line tool and library for generating FFI wrappers for Common Lisp","archived":false,"fork":false,"pushed_at":"2026-01-29T07:33:23.000Z","size":206,"stargazers_count":38,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-29T22:22:45.555Z","etag":null,"topics":["cffi","clang","common-lisp","ffi"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/sdilts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-02-04T23:00:39.000Z","updated_at":"2026-01-29T07:33:26.000Z","dependencies_parsed_at":"2025-09-26T17:33:32.407Z","dependency_job_id":"78ada602-bdf8-47d2-9ab3-19fb486acbd8","html_url":"https://github.com/sdilts/cl-bindgen","commit_stats":{"total_commits":158,"total_committers":1,"mean_commits":158.0,"dds":0.0,"last_synced_commit":"f42a65caef197a93a232911d339da41a14679717"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/sdilts/cl-bindgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdilts%2Fcl-bindgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdilts%2Fcl-bindgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdilts%2Fcl-bindgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdilts%2Fcl-bindgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdilts","download_url":"https://codeload.github.com/sdilts/cl-bindgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdilts%2Fcl-bindgen/sbom","scorecard":{"id":807079,"data":{"date":"2025-08-11","repo":{"name":"github.com/sdilts/cl-bindgen","commit":"cfe5cb6c05bce58804dd83a282ecaa6024da0633"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/python-app.yml:13","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-app.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/sdilts/cl-bindgen/python-app.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-app.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/sdilts/cl-bindgen/python-app.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-app.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/python-app.yml:29","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T12:05:04.758Z","repository_id":54827054,"created_at":"2025-08-23T12:05:04.758Z","updated_at":"2025-08-23T12:05:04.758Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28931091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T04:05:25.756Z","status":"ssl_error","status_checked_at":"2026-01-31T04:02:35.005Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cffi","clang","common-lisp","ffi"],"created_at":"2024-08-04T01:00:37.425Z","updated_at":"2026-01-31T06:04:22.264Z","avatar_url":"https://github.com/sdilts.png","language":"Python","readme":"# cl-bindgen\n\nA command line tool and library for creating Common Lisp language bindings\nfrom C header files.\n\nFeatures:\n+ Generates CFFI bindings for function declarations, enums, variables, unions,\n  and structures.\n+ Handles nested and anonymous structures, unions, and enums.\n  (See [#15](https://github.com/sdilts/cl-bindgen/pull/15))\n+ Warns when it cannot produce a correct binding.\n+ Documentation comments from the C source files are lispified and\n  included with the generated bindings when available.\n+ Provides a powerful way to customize how names are translated into\n  lisp symbols.\n\n## Installation\ncl-bindgen requires `libclang` and its Python bindings, which is not\ninstalled with the other Python dependencies. The bindings are\navailable on pypi, but the installed version needs to match the version\nof clang that is on your system. cl-bindgen is compatible with Clang\nversion 20.1 and higher, but will work with some problems on clang 19.1.\n\nIt is recommended libclang the correct python bindings first before\ninstalling cl-bindgen. Use your distribution's package manager to\ninstall it.\n\nOnce `libclang` is installed, you can then install `cl-bindgen` from\nsource:\n\n``` bash\ngit clone --depth=1 https://github.com/sdilts/cl-bindgen\ncd cl-bindgen\npip install .\n```\n\nWhen using pipx (Debian-based systems in particular), make sure that\nthe distro installed files are visible by passing in\n`--system-site-packages`:\n\n``` bash\npipx install --system-site-packages .\n```\n\n## Processing individual files\nTo process individual files, use the `f` command and specify one or\nmore files to process. By default, output will be printed to\nstdout, but the output file can be specified with the `-o` option. To see\na full list of options, run `cl-bindgen f -h`.\n\n``` bash\n# Process test.h and print the results to stdout:\ncl-bindgen f test.h\n# Process the files test1.h, test2.h, and place the output in output.lisp:\ncl-bindgen f -o output.lisp test1.h test2.h\n```\n\n## Batch file processing\ncl-bindgen can use a yaml file to process many header\nfiles with a single invocation. Use the `b` command\nto specify one or more batch files to process:\n\n``` bash\ncl-bindgen b my_library.yaml\n```\n\n### Batch file format\nBatch files use the YAML format. Multiple documents can be contained in each input file.\n\nRequired Fields:\n+ `output` : where to place the generated code\n+ `files` : a list of files to process\n\nOptional Fields:\n+ `package` : The name of the Common Lisp package of the generated file\n+ `arguments` : Arguments to pass to clang\n+ `force` : Ignore errors while parsing. Valid values are `True` or `False`\n+ `pkg-config`: A list of package names needed by the library. Adds\n  the flags needed to compile the given header files as told by\n  `pkg-config --cflags`\n+ `pointer-expansion` (experimental): Used to provide either a regex\n  or a list of pointer types to expand or not expand in the output.\n+ `make-inline` (experimental): Used to provide either a regex\n  or a list of names matching functions that should be declared\n  `inline`.\n+ `string-return` (experimental): Used to provide either a regex\n  or a list of names matching functions that should return `:string`\n  instead of `(:pointer :char)`\n\nTo see example batch files, look in the\n[examples](https://github.com/sdilts/cl-bindgen/tree/master/examples)\ndirectory.\n\n## Handling Include Directories and Clang Arguments\n\nIf you need to specify additional command line arguments to the clang\nprocessor, you can use the `-a` option, and list any clang arguments after.\n\n``` bash\ncl-bindgen b batch_file.yaml -a -I include_dir1 -I include_dir2\n# Use -- to stop collecting clang arguments:\n# Note that instead of directly calling pkg-config when using a batch\n# file, you can use the pkg-config option instead.\ncl-bindgen f -a `pkg-config --cflags mylibrary` -- header.h\n```\n\nIf a header file isn't found while processing the input files,\ncl-bindgen will halt and produce no output. This is to avoid producing\nincorrect bindings: while bindings can still be produced when header\nfiles are missing, they are likely to be incorrect. To ignore missing\nheader files and other fatal errors, the `-f` flag can be used:\n\n``` bash\ncl-bindgen b -f batch_file.yaml\ncl-bindgen f -f header.c\n```\n\n## Customizing the behavior of cl-bindgen\ncl-bindgen attempts to provide a reasonable interface that is usable\nin most cases. However, if you need to customize how C names are\nconverted into lisp names or embed cl-bindgen into another\napplication, cl-bindgen is available as a library.\n\nThe `cl_bindgen` package is broken up into modules: the `processfile`,\n`mangler`, `util` and `macro_util` modules. The `processfile` module provides the\nfunctions to generate the lisp bindings, the `mangler` module provides\nfunctions to convert C names into lisp names, and the `util` module\nprovides functions to use batch files and cl-bingen's command line\ninterface.\n\n### The `processfile` Module\n\nThis module exports two functions: `process_file` and `process_files`,\nwhich work on a single header file or many, respectively. Both\nfunctions take two arguments: the file(s) to be processed and an\n`ProcessOptions` object.\n\nThe `ProcessOptions`class is the way to specify how the\nprocessing functions generate their output. It has the following\nfields:\n\n+ `typedef_mangers`, `enum_manglers`, `type_manglers`, `name_manglers`\n  and `constant_manglers` : See the [mangler module section](#the-mangler-module)\n  for what these do.\n+ `output` : The path of the file where the output is\n  placed. `\":stdout\"` or `\":stderr\"` can be specified to use standard\n  out or standard error.\n+ `package` : If not `None`, this specifies the package the\n  generated output should be placed in.\n+ `arguments` : The command line arguments that should be given to the\n  clang processor.\n+ `force` : If true, then ignore errors while parsing the input files.\n+ `macro_detector`: The [macro detctor function](#the-macro_util-module)\n  used to detect header macros\n+ `expand_pointer_p`: A function that takes a typename and returns\n  whether or not pointers of this type should be fully expanded or\n  left as `:pointer`.\n\n### The `mangler` Module\n\ncl-bindgen uses a set of classes called manglers to translate C\nnames so that they follow lisp naming conventions. Each mangler class\nprovides one or more transformations to a symbol. For example, the\n`UnderscoreMangler` class converts underscores (`_`) into dashes\n(`-`). A series of manglers are applied to each C name to make it\nfollow lisp naming conventions.\n\nTo maximize customization, a list of manglers is associated with each\ntype of name that can be converted. enums, variable names, typedefs,\nconstants, and record types all use a different set of manglers.\n\nBuilt-in manglers:\n+ `UnderscoreMangler` : Converts underscores to dashes.\n+ `ConstantMangler` : Converts a string to follow Common Lisp's constant style\n  recomendation.\n+ `KeywordMangler` : Adds a `:` to the beginning of a string to make it a symbol.\n   Doesn't perform any action if the string has a package prefix.\n+ `RegexSubMangler` : Substitutes the substring matched by a regex\n  with the given string.\n+ `CamelCaseConverter` : Convert TitleCase and camelCase strings to\n  lisp-case strings that are all lower case.\n\n#### Mangler Interface\n\nMangler classes follow a simple interface:\n+ `can_mangle(string)`: returns true if the mangler can perform its\n  operations on the given string\n+ `mangle(string)`: returns a string with the desired transformations\n  applied.\n\n### The `util` Module\n\nThe `util` module provides functions for using batch files and\ncomposing objects together, processing arguments, etc.\n\n+ `process_batch_file(batch_file, options)` : Processes the given\n  batch file using `options` as the default options.\n+ `dispatch_from_arguments(arguments, options)` : Uses the provided\n  command line arguments to perform the actions of cl-bindgen using\n  `options` as the default options.\n+ `find_clang_resource_dir()` : This is needed if you build your own\n  `ProcessOptions` object and do not use the `dispatch_from_arguments`\n  function. The path returned by this function needs to be appended\n  to the clang arguments in order for the script to find built-in\n  headers. See the `add_clang_dir` function in this module.\n\n### The `macro_util` Module\n\nThis module provides the `macro_matches_file_path` function that is used\nby default to check if a macro is a header guard, and the\n`convert_literal_token` that converts literal tokens into CL literals.\n\nThe `macro_matches_file_path` is a macro detector function. Macro\ndetector functions are used to determine if a C macro is a header\nguard. They take two arguments: the location of the file and the name\nof the file as a string.\n\n### Examples\n\nThe best example of how to use cl-bindgen as a library is to look at its main\nfunction found in\n[cl\\_bindgen/\\_\\_main\\_\\_.py](https://github.com/sdilts/cl-bindgen/blob/master/cl_bindgen/__main__.py)\nand the\n[cl\\_bindgen/util.py](https://github.com/sdilts/cl-bindgen/blob/master/cl_bindgen/util.py)\nfile, specifically the `build_default_options` function.\n","funding_links":[],"categories":["C ##"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdilts%2Fcl-bindgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdilts%2Fcl-bindgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdilts%2Fcl-bindgen/lists"}