Wrapping additional native libraries / Source Generator availability?

boarnoah

New Member
Messages
1
Reaction score
0
From what I could see, a large chunk of the work in making native libraries usable with the niceties from Brutal.Interop is a lot of generated source, handling the marshalling and P/Invoke pieces?

Is the plan to release some (or most?) the Source Generators used to generate these libraries as part of the Brutal repo?
IIUC there is plans to release more build tooling for Brutal further down the line, it wasn't clear to me if Source Generators are encompassed by that.

Very curious to know just what sort of shape the generators are in, are they written generically to handle "most" native libraries without tweaks or is there a lot of customization that is bespoke to each library?

Would also love to know about any recommendations / thoughts folks working on Brutal have had so far re: deciding how exactly to wrap native libraries, any lessons learned / good practices that could be applied when we want to wrap additional native libraries would be great!

---

I apologize if this has been answered elsewhere but I was not able to find it on the r/gamedev thread, the Discord or here.
 
Yes, it does account for a lot of the work. No, we have no plans to share the generators. We want to focus on sharing the actual product (BRUTAL), and we don't consider the generator to be a critical part of it.

If you want to wrap your own libraries, here are some recommendations for me:

- Picking libraries built in C, or have a C API
- Start by only wrapping the raw P/Invoke, and manually write wrappers until you get a feel for how it should work
- Implement tests that verify types are byte-identical and function calls are equivalent on both ends.
 
Back
Top