remove extern c and no_mangle

This commit is contained in:
dignifiedquire
2019-04-27 01:42:58 +03:00
parent 9a1fcc745e
commit 1faf248e09
54 changed files with 789 additions and 1579 deletions

View File

@@ -2,6 +2,8 @@ extern crate cc;
use std::env;
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
fn main() {
let mut config = cc::Build::new();
config.file("misc.h");
@@ -31,10 +33,23 @@ fn main() {
}
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
cbindgen::Builder::new()
let cfg = cbindgen::Config::from_root_or_default(std::path::Path::new(&crate_dir));
let c = cbindgen::Builder::new()
.with_config(cfg)
.with_crate(crate_dir)
.generate()
.expect("Unable to generate bindings")
.write_to_file("deltachat.h");
.with_header(format!("/* deltachat Header Version {} */", VERSION))
// .with_language(cbindgen::Language::C)
.generate();
// This is needed to ensure we don't panic if there are errors in the crates code
// but rather just tell the rest of the system we can't proceed.
match c {
Ok(res) => {
res.write_to_file("deltachat.h");
}
Err(err) => {
eprintln!("unable to generate bindings: {:#?}", err);
std::process::exit(1);
}
}
}