rust-bindgen
rust-bindgen copied to clipboard
default ABI
the default ABI of the windows kernel is stdcall, so the most functions do not specify ABI.
Is it possible to increase the default ABI option?
example default_abi(name: &str)
bindgen::Builder::default().default_abi("stdcall"). ...;
Input C/C++ Header
// #include <ntifs.h>
#define DECLSPEC_IMPORT __declspec(dllimport)
#define NTKERNELAPI DECLSPEC_IMPORT // wdm ntndis ntifs
NTKERNELAPI
VOID
IoDeleteDevice (
PDEVICE_OBJECT DeviceObject
);
Bindgen Invocation
bindgen::Builder::default()
.header("wrapper/wrapper.h")
.use_core()
.derive_debug(false)
.layout_tests(false)
.ctypes_prefix("cty")
.default_enum_style(bindgen::EnumVariation::ModuleConsts)
.clang_arg(format!("-I{}", include_dir.to_str().unwrap()))
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.blocklist_type(".*")
.allowlist_function(".*")
.allowlist_recursively(false)
.generate()
.unwrap();
Actual Results
extern "C" {
pub fn IoDeleteDevice(DeviceObject: PDEVICE_OBJECT);
}
Expected Results
extern "stdcall" {
pub fn IoDeleteDevice(DeviceObject: PDEVICE_OBJECT);
}