Skip to content

Commit 5813198

Browse files
nagisaemilio
authored andcommitted
feat(dyngen): preconvert path to OsStr when opening the library
In libloading 0.9 the argument bound changed from `AsRef<OsStr>` to `libloading::AsFilename`. This was necessary in order to enable compilation of libloading for usecases that cannot depend on libstd. `libloading::AsFilename` supports most of the same types, but cannot be implemented generally for any `T: AsRef<OsStr>` due to the orphan rule. This makes the generated code support both 0.8 and 0.9 versions of libloading transparently, and at the same time it also reduces the number of different instantiations of `Library::new`. When bindgen is adjusted to work with libloading 0.9 only it will be worthwhile to adjust the generation of `from_library` to use `c"string"` literals over `b"string\0"` ones as those can forgo any runtime checking of the argument(s). However we can't do it right while libloading 0.8 is still supported.
1 parent 6fe5302 commit 5813198

12 files changed

+12
-0
lines changed

bindgen-tests/tests/expectations/tests/dynamic_loading_attributes.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_required.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_simple.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_template.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_variable_required.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_variable_simple.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_variable_with_allowlist.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_with_allowlist.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_with_blocklist.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bindgen-tests/tests/expectations/tests/dynamic_loading_with_class.rs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)