Hacker News new | ask | show | jobs
by dgellow 621 days ago
Yeah, that’s what I personally do but maintaining the PInvoke interface during development adds a good amount of overhead as things are changing around. It’s also a lot of boilerplate to deal with, and you only notice at runtime that something is wrong. It doesn’t feel like a well integrated solution
1 comments

If Zig can export C headers, you can easily generate the bindings out of them with CLangSharpPInvokeGenerator.

https://github.com/dotnet/ClangSharp

I strongly caution against WASM suggestions in a sibling comment - I’m not even sure if the author has actually done any C# at all, given how ridiculous it is.

Awesome, thanks for the link, that’s really useful!

WASM is definitely a strange suggestion here, I didn’t take it seriously. I’m already using a C-compatible zig library approach. Some details of the use case here: https://news.ycombinator.com/item?id=41729059

What is ridiculous in it?