This commit is contained in:
Hanh 2022-12-29 19:36:33 +08:00
parent cd1d84b25d
commit 4cfb0b30d6
2 changed files with 18 additions and 5 deletions

View File

@ -7,16 +7,13 @@ fn main() {
)
.unwrap();
// create_c_bindings();
create_c_bindings();
}
#[allow(dead_code)]
fn create_c_bindings() {
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let config = cbindgen::Config {
language: cbindgen::Language::C,
..Default::default()
};
let config = cbindgen::Config::from_root_or_default(".");
cbindgen::Builder::new()
.with_crate(crate_dir)

16
cbindgen.toml Normal file
View File

@ -0,0 +1,16 @@
language = "C"
no_includes = true
after_includes = """
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int uint16_t;
typedef long long int int64_t;
typedef long long int uint64_t;
typedef long long int uintptr_t;
typedef long int int32_t;
typedef long int uint32_t;
#ifndef __cplusplus
typedef char bool;
#endif
typedef void *DartPostCObjectFnType;
"""