rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.23k stars 679 forks source link

feat: add dynamic loading of variable #2812

Closed discord9 closed 2 months ago

discord9 commented 2 months ago

It's just a rebase of #2114 , since the original pull requests are closed, I thought might just rebase and create a new one for reviewing, @emilio.

Supporting for dynamic loading can be a useful feature when one need to found library in a dynamic way(i.e. choose between libraries with compatible ABI), and supporting loading static variable is a important feature in this feature.

emilio commented 2 months ago

I removed the get_var prefix because afaict it's not necessary, and I made it so that @pradt2 and you are both attributed authorship.