Skip to content

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

Closed
zhangjinpeng87 opened this issue Dec 26, 2016 · 4 comments
Closed

Comments

@zhangjinpeng87
Copy link

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
    }
}
@emilio
Copy link
Contributor

emilio commented Dec 26, 2016 via email

@emilio emilio changed the title bind rocksdb failed We generate invalid code for varargs functions (test-case: rocksdb) Dec 26, 2016
@zhangjinpeng87
Copy link
Author

@emilio Thanks for your response. The following is my wrapper.hpp file

// bindgen-flags: -- -std=c++11

#ifndef WRAPPER_HPP
#define WRAPPER_HPP

#include <rocksdb/db.h>

#endif /* !WRAPPER_HPP */

@emilio
Copy link
Contributor

emilio commented Jan 26, 2017

This is now fixed, see #402

@fitzgen
Copy link
Member

fitzgen commented Jul 21, 2017

This is now fixed, see #402

@fitzgen fitzgen closed this as completed Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants