{"id":19364288,"url":"https://github.com/mity/c-win32","last_synced_at":"2025-08-04T12:09:18.179Z","repository":{"id":152121397,"uuid":"225679515","full_name":"mity/c-win32","owner":"mity","description":"Few C-compatible win32 headers replacing standard ones which assume C++","archived":false,"fork":false,"pushed_at":"2022-01-16T12:51:47.000Z","size":20,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T14:39:22.667Z","etag":null,"topics":["c","header-only","help","replacement","win32"],"latest_commit_sha":null,"homepage":"","language":"C","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/mity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-12-03T17:36:05.000Z","updated_at":"2024-10-16T01:37:15.000Z","dependencies_parsed_at":"2023-09-18T07:01:09.855Z","dependency_job_id":null,"html_url":"https://github.com/mity/c-win32","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mity/c-win32","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mity%2Fc-win32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mity%2Fc-win32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mity%2Fc-win32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mity%2Fc-win32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mity","download_url":"https://codeload.github.com/mity/c-win32/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mity%2Fc-win32/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268694396,"owners_count":24291789,"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","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c","header-only","help","replacement","win32"],"created_at":"2024-11-10T07:37:00.727Z","updated_at":"2025-08-04T12:09:18.142Z","avatar_url":"https://github.com/mity.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# C-Win32 Readme\n\n\n## Overview\n\nThis \"project\" provides some header files which are moral replacements for\ncorresponding Win32API headers from Microsoft Windows SDK which require C++\nand which, as they are, are incompatible with plain C.\n\nSome background about this story can be found in [The oracle always tells the\ntruth, even when it is wrong: COM method calls with a user-defined type as a\nreturn value](https://devblogs.microsoft.com/oldnewthing/20220113-00/?p=106152))\nby Raymond Chen.\n\nOur headers certainly are not meant as a drop-in replacement for a whole SDK.\nWe only, by using a particular replacement header, allow using some particular\nSDK functionality which would otherwise be unusable from C.\n\n\n## Disclaimer\n\nBe warned that these replacement headers are **very incomplete**: They contain\nonly the stuff I have so far needed in my projects. Their instant usability in\nyour projects can be limited or require some work on your side.\n\nThat said, if you like the approach and find the headers useful, adding more\nstuff is usually quite easy and we are open to your pull requests.\n\nHowever as a rule of thumb, please follow **the following rule**: Add only such\nstuff you really use in your code. This is especially important for COM vtables\nwhich may be quite complicated and where any subtle error can introduce a binary\nincompatibility and hard-to-debug issues when used.\n\nFor example, when adding a new COM vtable, use just some dummy members for the\nmethods you do never call, just as placeholders in the vtable structure.\nSimilarly provide the convenient wrapping preprocessor macros only for those\nmethods you use (i.e. those which are not the placeholders.\n\n(See how the headers do this already.)\n\n\n## Naming Conventions\n\nOur headers have the same names as original ones, only with the prefix \"c-\".\nE.g. instead of `#include \u003cgdiplus.h\u003e`, use `#include \u003cc-gdiplus.h\u003e` in your\ncode.\n\nSimilarly, to avoid clashes with the standard identifiers (as some of them may\nhave forward declarations in other headers), all global identifiers provided by\nour headers use the prefix `c_`.\n\nThat includes:\n  - names of preprocessor macros,\n  - names of enumerations, structures, unions or other types, and\n  - members of enumerations (as in C those are also globally visible).\n\n(Non-member) functions may be more tricky because on one side we want them to\nbe easy to use without much extra type casting and at the same time, their name\nmust match the original function name, as exported by the target system DLL.\n\nFortunately, we have needed this so far only in very few cases (as we mainly\nreplace headers providing COM interfaces or interfaces quite similar to COM as\nGDI+). Therefore, we could solve these individually in what was seen as a\nreasonable trade-off in any particular situation.\n\n(If a need to add more function prototypes arises we may need to define some\ncommon way how to do that.)\n\n\n## Using C-Win32\n\n1. Just copy the needed headers into your project or instruct your compiler\n   where to find the headers, typically via `-Ipath/to/c-win32/include` command\n   line option.\n\n2. Include the replacement header instead of the vanilla one. E.g.:\n   ```\n   #include \u003cc-gdiplus.h\u003e\n   ```\n\n3. Use the prefix `c_` when referring to any global type or other global\n   identifier provided by the header.\n\nThe following projects use c-win32, so you can take a look how to use the\nreplacement headers:\n\n* [mCtrl](https://github.com/mity/mctrl)\n* [WinDrawLib](https://github.com/mity/windrawlib)\n\n\n## License\n\nThese headers are covered with MIT license, see the file `LICENSE.md`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmity%2Fc-win32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmity%2Fc-win32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmity%2Fc-win32/lists"}