{"id":16760131,"url":"https://github.com/maulingmonkey/abibool","last_synced_at":"2026-03-15T16:07:23.667Z","repository":{"id":57478837,"uuid":"316959035","full_name":"MaulingMonkey/abibool","owner":"MaulingMonkey","description":"C ABI compatible boolean types","archived":false,"fork":false,"pushed_at":"2022-08-21T23:18:49.000Z","size":15,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T17:58:46.604Z","etag":null,"topics":["bool","ffi","rust","winapi"],"latest_commit_sha":null,"homepage":"https://docs.rs/abibool","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaulingMonkey.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-29T13:38:04.000Z","updated_at":"2024-10-29T22:11:16.000Z","dependencies_parsed_at":"2022-09-17T04:21:53.801Z","dependency_job_id":null,"html_url":"https://github.com/MaulingMonkey/abibool","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaulingMonkey%2Fabibool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaulingMonkey%2Fabibool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaulingMonkey%2Fabibool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaulingMonkey%2Fabibool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaulingMonkey","download_url":"https://codeload.github.com/MaulingMonkey/abibool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225869311,"owners_count":17537129,"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":["bool","ffi","rust","winapi"],"created_at":"2024-10-13T04:22:28.005Z","updated_at":"2025-10-12T12:03:00.510Z","avatar_url":"https://github.com/MaulingMonkey.png","language":"Rust","readme":"# abibool - C ABI compatible boolean types\n\n[![GitHub](https://img.shields.io/github/stars/MaulingMonkey/abibool.svg?label=GitHub\u0026style=social)](https://github.com/MaulingMonkey/abibool)\n[![crates.io](https://img.shields.io/crates/v/abibool.svg)](https://crates.io/crates/abibool)\n[![docs.rs](https://docs.rs/abibool/badge.svg)](https://docs.rs/abibool)\n[![License](https://img.shields.io/crates/l/abibool.svg)](https://github.com/MaulingMonkey/abibool)\n[![Build Status](https://github.com/MaulingMonkey/abibool/workflows/Rust/badge.svg)](https://github.com/MaulingMonkey/abibool/actions?query=workflow%3Arust)\n\u003c!-- [![dependency status](https://deps.rs/repo/github/MaulingMonkey/abibool/status.svg)](https://deps.rs/repo/github/MaulingMonkey/abibool) --\u003e\n\nFor most sane rust APIs, you should prefer [bool] in your interfaces and simply convert between types.\nHowever, [bool] isn't legal for all bit patterns, making it unusable for most FFI without conversions.\nFor simple FFI, this isn't a problem, but C APIs writing arrays of\n[BOOL](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#BOOL) or\n[BOOLEAN](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#BOOLEAN),\nor structures containing\nthese types, become problematic and require allocations and copies to avoid undefined behavior.  Alternatively, you\n*could* just use integer types, that can obfuscate intent and result in bugs if multiple truthy-but-different value\nare directly compared when you expect boolean logic.\n\n## Type Map\n\nNote that this is *incredibly* system specific.\nE.g. BOOL for windows is 4 bytes, but for OS X it's 1 byte... probably.\u003cbr\u003e\nWhen using abibool to write FFI crates, you may wish to [`cc`](https://docs.rs/cc/)\na bunch of [`static_assert`](https://en.cppreference.com/w/cpp/language/static_assert)s\nin a build script to validate the size of your underlying C types.\n\n| C / C++ type                                                                                              | abibool type      | notes |\n| --------------------------------------------------------------------------------------------------------- | ----------------- | ----- |\n| `bool` (C++)                                                                                              | *varies*          | Often 1 byte, [but sometimes 4](https://github.com/OpenTTD/OpenTTD/commit/82f7140357b8b13e5f3c2eea715af936e5debb28) or worse\n| `_Bool` (C99 / stdbool.h)                                                                                 | *varies*          | Often 1 byte, [but sometimes 4](https://stackoverflow.com/a/10630231) or worse\n| [`BOOLEAN`](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#BOOLEAN) (Win32)    | [b8] / [bool8]    |\n| [`BOOL`](https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#BOOL) (Win32)          | [b32] / [bool32]  |\n| [`BOOL`](https://opensource.apple.com/source/objc4/objc4-706/runtime/objc.h.auto.html) (OS X / objc.h)    | [b8] / [bool8] ?  | Typically `signed char`, but sometimes [bool](https://stackoverflow.com/a/544250) or [unsigned char](https://code.woboq.org/gcc/libobjc/objc/objc.h.html)\n| [`jboolean`](https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html) (Java / JNI)     | [b8] / [bool8]    |\n\n## References\n\n*   [BOOL / bool / Boolean / NSCFBoolean](https://nshipster.com/bool/)          - Objective C truthy types\n\n\n\n\u003ch2 name=\"license\"\u003eLicense\u003c/h2\u003e\n\nLicensed under either of\n\n* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n\n\n\u003ch2 name=\"contribution\"\u003eContribution\u003c/h2\u003e\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n\n\n\u003c!-- references --\u003e\n\n[bool]:             https://doc.rust-lang.org/core/primitive.bool.html\n[b8]:               https://docs.rs/abibool/*/abibool/struct.bool8.html\n[bool8]:            https://docs.rs/abibool/*/abibool/struct.bool8.html\n[b32]:              https://docs.rs/abibool/*/abibool/struct.bool32.html\n[bool32]:           https://docs.rs/abibool/*/abibool/struct.bool32.html\n[winapi]:           https://docs.rs/winapi/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaulingmonkey%2Fabibool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaulingmonkey%2Fabibool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaulingmonkey%2Fabibool/lists"}