Let me explain what I currently have:
- A third party dynamic library and its C header file
-syscrate generating Rust raw bindings using
bindgen, it also links to the dynamic library during its
- A wrapper crate that uses the
I would like another crate (say
-mock) to implement the C symbols that the
-sys crate exports. Is that possible?
I know two ways to do this:
- I can blacklist the function during
bindgenand pick the
-mockfunction in the wrapper, all of this behind a feature flag (kinda eh but it works)
- I can point
cargo's search path to
-mocklibrary has been built (not happy with that one)
I’m wondering if there’s no dead simple way to do this that I’m missing, it seems like a fairly simple usecase?
I couldn’t find anything when searching for my issue but I’m not exactly well versed in linking and the likes.
I’ve made a “short, self-contained example” repo that should help you get started if you have an idea on how to solve it: https://github.com/ldesgoui/sys_mock_example