-
Notifications
You must be signed in to change notification settings - Fork 156
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
Codegen results in function call with incorrect number of arguments #1342
Comments
I just updated the repo to use The build now fails with:
|
Here's a concrete real life example (attemping to use autocxx with Half-Life SDK) stevefan1999-personal/autocxx-bug-operator-new (github.com) |
Hi @paulyoung , did you manage to solve this in the end? I'm also running into this issue. |
@pevers I didn't. I thought about trying to fix the issue and submitting a PR or writing something by hand instead but my project is fairly low priority so I haven't invested any more time into it. |
I might at least add some failing test cases. |
Please do! |
@adetaylor was just thinking about doing this again yesterday. |
I tried following the steps at https://github.com/google/autocxx/blob/ca48925c04ae84cc3c61153fa230db9c899fcb53/book/src/reporting_bugs.md I wasn't able to produce a reduce test case. The command in the above document appears to be out of date but even with that I kept getting an error. Perhaps I was doing something wrong.
I figured the test case at https://github.com/paulyoung/autocxx-bug is probably minimal enough so moved on to the next step. With bindgen, I ran into this:
Apparently I needed to add the cargo run -- ~/projects/paulyoung/autocxx-bug/main/include/MyClass.h --no-layout-tests --enable-cxx-namespaces --allowlist-type MyClass -- -x c++ -std=c++14 ✘ 101
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.04s
Running `target/debug/bindgen /Users/py/projects/paulyoung/autocxx-bug/main/include/MyClass.h --no-layout-tests --enable-cxx-namespaces --allowlist-type MyClass -- -x c++ -std=c++14`
clang diag: /nix/store/j3dhkx4m14m38drh3f40bccrwrgzlsg5-libcxx-19.1.7-dev/include/c++/v1/__configuration/compiler.h:41:8: warning: "Libc++ only supports AppleClang 15 and later" [-W#warnings]
Warning: can't set `binop_separator = Back`, unstable features are only available in nightly channel.
/* automatically generated by rust-bindgen 0.71.1 */
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
#[allow(unused_imports)]
use self::super::root;
#[repr(C)]
pub struct MyClass__bindgen_vtable(::std::os::raw::c_void);
#[repr(C)]
#[derive(Debug)]
pub struct MyClass {
pub vtable_: *const MyClass__bindgen_vtable,
}
unsafe extern "C" {
#[link_name = "\u{1}__ZN7MyClassC1Ev"]
pub fn MyClass_MyClass(this: *mut root::MyClass);
}
impl MyClass {
#[inline]
pub unsafe fn new() -> Self {
let mut __bindgen_tmp = ::std::mem::MaybeUninit::uninit();
MyClass_MyClass(__bindgen_tmp.as_mut_ptr());
__bindgen_tmp.assume_init()
}
}
unsafe extern "C" {
#[link_name = "\u{1}__ZN7MyClassD1Ev"]
pub fn MyClass_MyClass_destructor(this: *mut root::MyClass);
}
} I've created a draft PR at #1475 with some test cases I added. I've been running them with Some of the existing tests (e.g.
|
Describe the bug
The build fails with the following:
To Reproduce
Try to build the project at https://github.com/paulyoung/autocxx-bug
Expected behavior
Codegen results in code supplying the correct number of arguments.
Additional context
In reality I don't control the header files so any potential workarounds would preferably not involve modifying them.
The text was updated successfully, but these errors were encountered: