Hacker GitHub

← All repos

microsoft/CsWin32

View on GitHub ↗ ★ 2,527 C#

A source generator to add a user-defined set of Win32 P/Invoke methods and supporting types to a C# project.

9 mentions on Hacker News by 5 people: 1 story, 8 comments · first 2022-06-10 · latest 2026-03-22

Mentions per year 9 mentions · busiest year 2024 (4)
20082026
  1. Thanfully, you don't need to write p/invoke stuff yourself anymore. https://github.com/microsoft/cswin32 creates methods and all related structs for you. It's also AOT compatible (if you specify it). It works for calling C and COM…
    comment by Pesthuf · 2026-03-22 · in Windows native app development is a mess
  2. …spans, et. al., make the overhead undetectable in many cases. https://github.com/prasannavl/WinApi https://github.com/microsoft/CsWin32
    comment by bob1029 · 2026-02-15 · in I fixed Windows native development
  3. …libraries. Some time ago I described this process on my blog for the detours library [2] [1] https://github.com/microsoft/CsWin32 [2] https://lowleveldesign.org/2023/11/23/generating-c-bindings-...
  4. ▲ 4
    C#/Win32 P/Invoke Source Generator
    story by bob1029 · 2025-05-14 · 0 comments
  5. …ttps://github.com/dotnet/ClangSharp?tab=readme-ov-file#gene... Also because this is Windows, there is https://github.com/microsoft/CsWin32 already (and adjacent libraries) which rely on the same generator.
  6. …with native memory blocks is straightforward and intuitive for people with C/C++ background. [1] https://github.com/microsoft/CsWin32 [2] https://lowleveldesign.wordpress.com/2024/07/11/implementing...
  7. …mine recently got rid of C++ component thanks to the former, simplifying the solution build. [0]: https://github.com/microsoft/CsWin32 [1]: https://github.com/microsoft/CsWinRT
    comment by neonsunset · 2024-06-24 · in LINQPad – The .NET Programmer's Playground
  8. …COM interests only a limited part of community, and there also exists actively maintained https://github.com/microsoft/CsWin32 A popular (if not the most, depending on location) choice to use EF Core with is PostgreSQL. Meanwhile, ASP.NET…
    comment by neonsunset · 2024-03-26 · in Tech Debt: My Rust Library Is Now a CDO
  9. …implementations for my own amusement. A quick Google Search netted the following project ( https://github.com/microsoft/CsWin32 ). Looks like my evening is gone.