ryankurte / rust-bladerf

Libbladerf wrapper for rust
MIT License
7 stars 3 forks source link

Question about bingen bindings #4

Open QuantumEF opened 2 months ago

QuantumEF commented 2 months ago

It looks like you all are using your own version of rust-bindgen generated bindings of libbladerf. I wanted to ask if yall were aware of the official bindings at : https://github.com/Nuand/libbladeRF-rust ? It seems relatively newer compared to the age of this project, so I assumed you might not know about it yet.

Would it be worthwhile moving over to the official bindings? Further, are there any issues with the project I could help with? I am interested in this project and at some point would like to make a wrapper using seify for use with FutureSDR.

ryankurte commented 1 month ago

yeah i started working on these a loong time ago (maybe my first foray into rust) and both the ecosystem and i have changed a bit since then! no opposition to adopting their bindings, but, also not sure it offers any particular advantage, and their repo seems like a quick first effort rather than a more systematic approach.

if the goal is to improve the state of bladerf bindings i think the best things to do would be:

which should all be pretty straightforward, i've swapped to bindgen and added the -sys split as a start, but there's lots of changes to the library as well as missing wrappers that i don't have time to look at at the moment if you're interested in continuing.

QuantumEF commented 1 month ago

Thanks for your reply. When I initially was looking at this repo, it seemed like it was being done a different way. Now that you are also using the autogenerated bindgen bindings, I don't see to much of a difference.

As I have time, I am going to continue looking into the code to better understand how libbladerf itself works, and hopefully actually contribute to this project. We will see though.

Feel free to close the issue, though I think you should leave it open since it provides a useful todo list.

ryankurte commented 1 month ago

When I initially was looking at this repo, it seemed like it was being done a different way.

yeah before it was a combination of old generated bindings mixed together with custom types / and safe wrappers, not great practice by modern c library binding standards ^_^

Now that you are also using the autogenerated bindgen bindings, I don't see to much of a difference.

the other reason to keep -sys bindings here is to be able to polyfill methods etc. on generated types without running afoul of the orphan rule (though you can mitigate this to some extent with traits), so i think it's best to keep them together.

As I have time, I am going to continue looking into the code to better understand how libbladerf itself works, and hopefully actually contribute to this project. We will see though.

no stress either way, let me know if i can clarify anything ^_^