You’ll need to write shims in plain C to work with either of these libraries. It’ll likely be easier to do that on top of the C++ library, although I believe .Net includes marshalling functionality to interoperate with C so theoretically there should be a way to use that too.
To do this, you’ll need to set up a C language target in your Swift package. The official documentation could use some improvement here, but if you Google for “SwiftPM C target”, you should find some relatively-recent tutorials. Essentially it involves declaring the target and putting the public headers where SwiftPM can find them.
Using a binary library isn’t a problem; you just need to tell the linker where to find it. There are 2 ways to do that:
- Use a custom modulemap (this might only apply to system libraries, I’m not sure)
- Add custom linker settings in your SwiftPM package manifest
Apologies that I can’t tell you exactly what you need to do to make this work, but hopefully this helps guide you to finding a solution.