-
Notifications
You must be signed in to change notification settings - Fork 744
We generate invalid code for varargs functions (test-case: rocksdb) #361
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
Comments
Can you post your wrapper.hpp and your bindings.rs file?
We don't support varargs functions right now (and I don't think we can
support them properly), but we should skip generating code for them.
That's a known defect, but there are several things you can do to work
around this known defects when binding C++.
The unofficial guide is here:
* #342 (comment)
But we should definitely clean that up and write up a user guide to how
to use bindgen effectively with C++, since it may not be as
straight-forward as binding to C libraries.
I'm leaving this open to track the varargs constructor (and functions in
general) issue.
Thanks for reporting this!
…On Mon, Dec 26, 2016 at 12:01:17AM -0800, zhangjinpeng1987 wrote:
When I use `libbindgen` with rocksdb, code in bindings.rs doesn't work.
build.rs
```
extern crate libbindgen;
use std::env;
use std::path::PathBuf;
fn main() {
// Tell Cargo to tell rustc to link the system rocksdb shared library.
println!("cargo:rustc-link-lib=rocksdb");
let bindings = libbindgen::Builder::default()
.no_unstable_rust()
.clang_arg("-std=c++11")
.header("wrapper.hpp")
.generate()
.expect("Unable to generate bindings");
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
bindings.write_to_file(out_path.join("bindings.rs")).expect("Couldn't write bindings!");
}
```
code snip in bindings.rs
```
impl std_namespace___any {
#[inline]
pub unsafe fn new(, ...) -> Self { // doesn't work
¦ let mut __bindgen_tmp = ::std::mem::uninitialized();
¦ std_namespace___any___any(&mut __bindgen_tmp);
¦ __bindgen_tmp
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#361
|
@emilio Thanks for your response. The following is my
|
This is now fixed, see #402 |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I use
libbindgen
with rocksdb, code in bindings.rs doesn't work.build.rs
code snip in bindings.rs
The text was updated successfully, but these errors were encountered: