-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why bindgen interpret wchar_t type as ::std::os::raw::c_int? #1745
Comments
You're not doing anything wrong, as far as I can tell. The bug is not in the function signature, but in the constant definition, that should ideally be a wide char array. I took a look, and I filed #1745, closing as a dupe of that. |
@emilio thank you! You posted link to exact this issue. Should be jethrogb/rust-cexpr#25 (Allow to distinguish wide strings from regular strings) I guess. |
Err, whoops, indeed :) |
In the meantime, though ugly (and assuming the key won't change), you can do something like:
Or if you're in control of the C headers you can do something like:
And you should be able to use the |
This is a question.
I have compiled dynamic C library, a header file for it and a documentation. I successfully built bindings with bindgen. I got
pub type wchar_t = ::std::os::raw::c_int;
in mybindings.rs
. But looks like C function must acceptwchar_t
as string.Input C Header
bindings.rs
I'm struggling to create safe wrapper around this functions because key const has type
[u8]
but the function expectsi32
(c_int
) as argument.Here is my wrapper:
It doesn't compile: raw_key expected to be
i32
, found&[u8; 11]
.What am I doing wrong? Any help would be appreciated.
The text was updated successfully, but these errors were encountered: