-
Notifications
You must be signed in to change notification settings - Fork 150
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
Function with wchar_t
generated using std::uint32_t
instead of wchar_t
#1141
Comments
Thanks for the report. I'm currently on vacation, so I'm unlikely to have a chance to reproduce this myself within the next few weeks. If you're feeling generous, please could you raise a pull request with a new test case per these instructions? That way I'm more likely to take a look at fixing this sooner. |
@adetaylor Thanks for getting back so quickly. Here's the PR: #1142 Hope you have a good rest of your vacation! |
Thanks for the test case, that helps a lot. A bit of investigation. Here's a pure-bindgen test case, which does the right thing. [package]
name = "test-proj"
version = "0.1.0"
edition = "2021" mod bindgen_output;
fn main() {
println!("Ade 1");
unsafe { bindgen_output::next_wchar(3) };
println!("Ade 2");
} #include <stddef.h>
#include <cstdint>
wchar_t next_wchar(wchar_t c); #include "header.hpp"
wchar_t next_wchar(wchar_t c) {
return c;
} build.rs: fn main() {
println!(r"cargo:rustc-link-lib=wchartest");
println!(r"cargo:rustc-link-search=/Users/adetaylor/dev/bindgen/test-proj");
} Built with:
Bindgen's output is: extern "C" {
#[link_name = "\u{1}__Z10next_wcharw"]
pub fn next_wchar(c: u32) -> u32;
} This works because, at least on this specific platform, This doesn't work for autocxx since we generate C++ which calls into the existing C++. I think therefore this will be another thing for the list on #124 where we need bindgen to output some extra metadata such that we can distinguish this case within autocxx. Next step will be to look at how easy it is to spot this distinction within the bindgen code based on the clang output. It's possible we might run into jethrogb/rust-cexpr#25 / rust-lang/rust-bindgen#1745. |
|
Oh, we were already doing that. |
I'm not going to attempt to make progress here until the linked bindgen issues have progress. @jjacobson93 thanks again for the test case PR, it's much appreciated, and sorry this hasn't yielded a quick fix. |
Hello, I'm running into this issue with |
I think a fix for jethrogb/rust-cexpr#25 is a pre-requisite for any progress in autocxx. |
Expected Behavior
Function with
wchar_t
as a parameter should generate successfully.Actual Behavior
Function with
wchar_t
is generated usingstd::uint32_t
instead ofwchar_t
, emitting a clang error.Clang error
Full error from running build
Steps to Reproduce the Problem
Cargo.toml
build.rs
src/main.rs
bad.hpp
bad.cpp
cargo build
at the root of the project.Specifications
cargo version -v
The text was updated successfully, but these errors were encountered: