{"id":13452987,"url":"https://github.com/graphitemaster/incbin","last_synced_at":"2026-01-11T14:03:32.115Z","repository":{"id":26758372,"uuid":"30216244","full_name":"graphitemaster/incbin","owner":"graphitemaster","description":"Include binary files in C/C++","archived":false,"fork":false,"pushed_at":"2025-05-26T23:47:50.000Z","size":78,"stargazers_count":1110,"open_issues_count":8,"forks_count":104,"subscribers_count":28,"default_branch":"main","last_synced_at":"2025-10-10T13:46:57.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphitemaster.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":"2015-02-03T00:21:03.000Z","updated_at":"2025-10-08T00:49:30.000Z","dependencies_parsed_at":"2024-10-30T23:02:57.813Z","dependency_job_id":null,"html_url":"https://github.com/graphitemaster/incbin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/graphitemaster/incbin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fincbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fincbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fincbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fincbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphitemaster","download_url":"https://codeload.github.com/graphitemaster/incbin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fincbin/sbom","scorecard":{"id":443813,"data":{"date":"2025-08-11","repo":{"name":"github.com/graphitemaster/incbin","commit":"22061f51fe9f2f35f061f85c2b217b55dd75310d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Code-Review","score":2,"reason":"Found 6/24 approved changesets -- score normalized to 2","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":6,"reason":"3 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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: UNLICENSE:0","Info: FSF or OSI recognized license: The Unlicense: UNLICENSE: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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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-19T06:12:44.956Z","repository_id":26758372,"created_at":"2025-08-19T06:12:44.956Z","updated_at":"2025-08-19T06:12:44.956Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28306985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T11:18:18.743Z","status":"ssl_error","status_checked_at":"2026-01-11T11:07:56.842Z","response_time":60,"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":[],"created_at":"2024-07-31T08:00:30.135Z","updated_at":"2026-01-11T14:03:32.097Z","avatar_url":"https://github.com/graphitemaster.png","language":"C","readme":"# incbin\n\nInclude binary and textual files in your C/C++ applications with ease\n\n## Example\n\n``` c\n    #include \"incbin.h\"\n\n    INCBIN(Icon, \"icon.png\");\n\n    // Reference in other translation units like this\n    INCBIN_EXTERN(Icon);\n\n    // NOTE: Don't forget to use `extern \"C\"` in case of writing C++ code\n\n    // You may specify an optional type for the included data array as a first\n    // additional argument to INCBIN, the macro is overloaded by arity. The\n    // default type is `unsigned char`.\n    INCBIN(MyType, IconTyped, \"icon.png\");\n\n    // INCTXT is the same as INCBIN but it uses type `char` by default and \n    // implicitly adds a NUL-terminator byte to the included data, making it\n    // safe to use as a string in C.\n    INCTXT(Readme, \"readme.md\");\n\n    // Reference in other translation units like this\n    INCTXT_EXTERN(Readme);\n\n    // NOTE: Since INCTXT adds a NUL-terminator byte, it's size is one byte\n    // larger than that of INCBIN, so subtract one for string length.\n\n    // The macros produce three global (or external) symbols of the form\n    // \u003ctype\u003e \u003cprefix\u003e\u003cdata\u003e\u003cname\u003e[]\n    // \u003ctype\u003e \u003cprefix\u003e\u003cend\u003e\u003cname\u003e*\n    // unsigned int \u003cprefix\u003e\u003csize\u003e\u003cname\u003e\n    //\n    // The \u003ctype\u003e by default is unsigned char, unless optionally provided.\n    // The \u003cprefix\u003e by default is \"g\", you can override it with INCBIN_PREFIX.\n    // The \u003cname\u003e is the identifier you give to INCBIN or INCTXT.\n    // The \u003cdata\u003e, \u003cend\u003e, and \u003csize\u003e are tokens that depend on INCBIN_STYLE, by\n    // default they're \"Data\", \"End\", and \"Size\", but they can be changed to\n    // \"_data\", \"_end\", and \"_size\" if INCBIN_STYLE is set to INCBIN_STYLE_SNAKE.\n```\n\n## Portability\n\nKnown to work on the following compilers\n\n* GCC\n* Clang\n* PathScale\n* Intel\n* Solaris \u0026 Sun Studio\n* Green Hills\n* SNC (ProDG)\n* Diab C++ (WindRiver)\n* XCode\n* ArmCC\n* RealView\n* ImageCraft\n* Stratus VOS C\n* TinyCC\n* cparser \u0026 libfirm\n* LCC\n* MSVC _See MSVC below_\n\nIf your compiler is not listed, as long as it supports GCC inline assembler, this\nshould work.\n\n## MISRA\nINCBIN can be used in MISRA C setting. However it should be independently checked\ndue to its use of inline assembly to achieve what it does. Independent verification\nof the header has been done several times based on commit: 7e327a28ba5467c4202ec37874beca7084e4b08c\n\n## Alignment\n\nThe data included by this tool will be aligned on the architectures word boundary\nunless some variant of SIMD is detected, then it's aligned on a byte boundary that\nrespects SIMD convention just incase your binary data may be used in vectorized\ncode. The table of the alignments for SIMD this header recognizes is as follows:\n\n| SIMD                                    | Alignment |\n|-----------------------------------------|-----------|\n| SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2  | 16        |\n| Neon, AltiVec                           | 16        |\n| AVX, AVX2                               | 32        |\n| AVX512                                  | 64        |\n\n## Prefix\nBy default, `incbin.h` emits symbols with a `g` prefix. This can be adjusted by\ndefining `INCBIN_PREFIX` before including `incbin.h` with a desired prefix. For\ninstance\n\n``` c\n    #define INCBIN_PREFIX g_\n    #include \"incbin.h\"\n    INCBIN(test, \"test.txt\");\n\n    // This translation unit now has three symbols\n    // const unsigned char g_\u003cname\u003e\u003cdata\u003e[];\n    // const unsigned char *const g_\u003cname\u003e\u003cend\u003e;\n    // const unsigned int g_\u003cname\u003e\u003csize\u003e;\n```\n\nYou can also choose to have no prefix by defining the prefix with nothing, for example:\n\n``` c\n    #define INCBIN_PREFIX\n    #include \"incbin.h\"\n    INCBIN(test, \"test.txt\");\n\n    // This translation unit now has three symbols\n    // const unsigned char \u003cname\u003e\u003cdata\u003e[];\n    // const unsigned char *const \u003cname\u003e\u003cend\u003e;\n    // const unsigned int \u003cname\u003e\u003csize\u003e;\n```\n\n## Style\nBy default, `incbin.h` emits symbols with `CamelCase` style. This can be adjusted\nby defining `INCBIN_STYLE` before including `incbin.h` to change the style. There\nare two possible styles to choose from\n\n* INCBIN_STYLE_CAMEL (CamelCase)\n* INCBIN_STYLE_SNAKE (snake_case)\n\nFor instance:\n\n``` c\n    #define INCBIN_STYLE INCBIN_STYLE_SNAKE\n    #include \"incbin.h\"\n    INCBIN(test, \"test.txt\");\n\n    // This translation unit now has three symbols\n    // const unsigned char \u003cprefix\u003e\u003cname\u003e_data[];\n    // const unsigned char *const \u003cprefix\u003e\u003cname\u003e_end;\n    // const unsigned int \u003cprefix\u003e\u003cname\u003e_size;\n```\n\nCombining both the style and prefix allows for you to adjust `incbin.h` to suite\nyour existing style and practices.\n\n## Overriding Linker Output section\nBy default, `incbin.h` emits into the read-only linker output section used on\nthe detected platform. If you need to override this for whatever reason, you\ncan manually specify the linker output section.\n\nFor example, to emit data into program memory for\n[esp8266/Arduino](github.com/esp8266/Arduino):\n\n``` c\n#define INCBIN_OUTPUT_SECTION \".irom.text\"\n#include \"incbin.h\"\nINCBIN(Foo, \"foo.txt\");\n// The three symbols below will all go to \".irom.text\"\n// \u003ctype\u003e \u003cprefix\u003e\u003cdata\u003e\u003cname\u003e[]\n// \u003ctype\u003e \u003cprefix\u003e\u003cend\u003e\u003cname\u003e*\n// unsigned int \u003cprefix\u003e\u003csize\u003e\u003cname\u003e\n```\n\nYou may also override the output section for data, and size separately, this is\nuseful for Harvard architectures where program memory cannot be directly read\nfrom the program without special instructions. With this you can chose to put\nthe size variable in RAM rather than ROM. This can be done with the macros\n\n```c\n// \u003cprefix\u003e\u003cdata\u003e\u003cname\u003e and \u003cprefix\u003e\u003cend\u003e\u003cname\u003e goes into custom data section\n#define INCBIN_OUTPUT_DATA_SECTION \"...\"\n\n// \u003cprefix\u003e\u003csize\u003e\u003cname\u003e goes into custom size section.\n#define INCBIN_OUTPUT_SIZE_SECTION \"...\"\n```\n\n## Explanation\n\n`INCBIN` is a macro which uses the inline assembler provided by almost all\ncompilers to include binary files. It achieves this by utilizing the `.incbin`\ndirective of the inline assembler. It then uses the assembler to calculate the\nsize of the included binary and exports two global symbols that can be externally\nreferenced in other translation units which contain the data and size of the\nincluded binary data respectively.\n\n## MSVC\n\nSupporting MSVC is slightly harder as MSVC lacks an inline assembler which can\ninclude data. To support this we ship a tool which can process source files\ncontaining `INCBIN` macro usage and generate an external source file containing\nthe data of all of them combined. This file is named `data.c` by default.\nJust include it into your build and use the `incbin.h` to reference data as\nneeded. It's suggested you integrate this tool as part of your projects's\npre-build events so that this can be automated. A more comprehensive list of\noptions for this tool can be viewed by invoking the tool with `-help`\n\nIf you're using a custom prefix, be sure to specify the prefix on the command\nline with `-p \u003cprefix\u003e` so that everything matches up; similarly, if you're\nusing a custom style, be sure to specify the style on the command line with\n`-S \u003cstyle\u003e` as well.\n\n\u003e NOTE: MSVC currently does not support `INCTXT` or custom optional type on\n`INCBIN`. This will be changed in the future.\n\n## Miscellaneous\n\nDocumentation for the API is provided by the header using Doxygen notation.\nFor licensing information see UNLICENSE.\n","funding_links":[],"categories":["C","Tools","工具","Uncategorized","Libraries"],"sub_categories":["YAML","Embeddable Scripts and Languages","C"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Fincbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphitemaster%2Fincbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Fincbin/lists"}