r/cpp • u/holyblackcat • Apr 02 '26
Announcing mrbind, an automatic C/C#/Python binding generator for C++
https://holyblackcat.github.io/blog/2026/04/02/announcing-mrbind.html
30
Upvotes
r/cpp • u/holyblackcat • Apr 02 '26
15
u/_VZ_ wx | soci | swig Apr 02 '26
This is not true (source: trust me, I'm its coauthor).
4
u/FlyingRhenquest Apr 02 '26
Just in time for reflection! Heh heh. I started working on a little class parser just before Sutter did his talk about it in January, so I kinda know how that feels. I mostly did the project to learn a bit about boost::spirit::x3, though, and found it remarkably approachable. The problem was also surprisingly small, since I just wanted to gather the same information that reflection provides, so I didn't have to do comprehensive parsing for template signatures or inline code in the header.
Embind should be pretty easy to add to mrbind. Its interface is very similar to pybind/nanobind. Java native might be feasible too, which would make targeting android architectures a lot easier if you're into that sort of thing. I was going to look into doing a project like this with reflection but I seem to be over here generating JSON schema instead, at the moment.
2
u/RelationshipLong9092 Apr 02 '26
How does this compare to nanobind or pybind?
1
u/QbProg Apr 02 '26
Nice! I was looking for something similar a couple weeks ago! I ended using swig
Let me report a couple issues I found when using swig, just to let you know.
wasm: I know there's embinden but a sort of unified interface (without manual wrapping) would be useful. Maybe the embinden code could be generated automatically
Coroutines :not easy to bind at all but having the ability to expose a task with a function / callback and on the other side have an awaitable would be great 😁 at the moment can be done manually on both sides, but the code is very specific.
1
u/Serious-Regular Apr 02 '26
i've been following you on GH for a while now (maybe 6-12 months). congrats. question: any chance you're planning on a migration to nanobind any time soon?
1
u/c-cul Apr 03 '26
how hard to add some kind of FFI to it?
2
u/akintos Apr 03 '26
I'm definately trying this out. thank you for great work