You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On my platform char is signed, thus trying to assign a char-string constant (which becomes &[u8, _] in Rust) to a char * field in a struct results in a mismatched types error.
This one was a little surprising, but is understandable given C's fuzzyness around what a char is.
I could understand closing this as WONTFIX due to the likely breakage such a change would cause (as well as the annoyance of working with std::os::raw::c_char), but would at least be useful to add to the FAQ.
Alternatively there could be some sort of flag to bindgen control this behaviour.
This one kinda sucks because char can be either signed or unsigned (and technically doesn't even have to be 8-bits). Here's a version that strictly preserves the types:
I think this is also related to #1401... I think there are use-cases that benefit from the current behavior (mostly, interacting with the core::ffi stuff), and others that would benefit from keeping the exact type (like adding members to a struct).
We could add a flag of sorts, if wanted, but an entry in the FAQ until that happens would definitely be amazing!
On my platform
char
is signed, thus trying to assign a char-string constant (which becomes&[u8, _]
in Rust) to achar *
field in a struct results in a mismatched types error.This one was a little surprising, but is understandable given C's fuzzyness around what a
char
is.I could understand closing this as WONTFIX due to the likely breakage such a change would cause (as well as the annoyance of working with
std::os::raw::c_char
), but would at least be useful to add to the FAQ.Alternatively there could be some sort of flag to bindgen control this behaviour.
Input C/C++ Header
Bindgen Invocation
Actual Results
Expected Results
This one kinda sucks because
char
can be either signed or unsigned (and technically doesn't even have to be 8-bits). Here's a version that strictly preserves the types:The text was updated successfully, but these errors were encountered: