Remove "std" writer from `windows-bindgen` (#3130)
This commit is contained in:
Родитель
707e0bb329
Коммит
f69ba3d2f6
|
@ -248,7 +248,7 @@ fn gen_link(writer: &Writer, namespace: &str, signature: &metadata::Signature) -
|
|||
quote! {}
|
||||
};
|
||||
|
||||
if writer.std || !namespace.starts_with("Windows.") {
|
||||
if !namespace.starts_with("Windows.") {
|
||||
let library = library.trim_end_matches(".dll");
|
||||
|
||||
quote! {
|
||||
|
|
|
@ -31,8 +31,7 @@ pub fn from_reader(
|
|||
let mut writer = Writer::new(reader, output);
|
||||
writer.package = config.remove("package").is_some();
|
||||
writer.flatten = config.remove("flatten").is_some();
|
||||
writer.std = config.remove("std").is_some();
|
||||
writer.sys = writer.std || config.remove("sys").is_some();
|
||||
writer.sys = config.remove("sys").is_some();
|
||||
writer.implement = config.remove("implement").is_some();
|
||||
writer.minimal = config.remove("minimal").is_some();
|
||||
writer.no_inner_attributes = config.remove("no-inner-attributes").is_some();
|
||||
|
|
|
@ -13,7 +13,6 @@ pub struct Writer {
|
|||
//
|
||||
// Maybe this macro is the embedable version of the IDL format?! like a more intelligient
|
||||
// version of the existing interface macro...
|
||||
pub std: bool, // tweaks for internal std library support
|
||||
pub sys: bool, // writer sys-style bindings
|
||||
pub flatten: bool, // strips out namespaces - implies !package
|
||||
pub package: bool, // default is single file with no cfg - implies !flatten
|
||||
|
@ -33,7 +32,6 @@ impl Writer {
|
|||
output: output.to_string(),
|
||||
namespace: "",
|
||||
implement: false,
|
||||
std: false,
|
||||
sys: false,
|
||||
flatten: false,
|
||||
package: false,
|
||||
|
|
|
@ -5,27 +5,11 @@
|
|||
dead_code,
|
||||
clippy::all
|
||||
)]
|
||||
#[link(name = "advapi32")]
|
||||
extern "system" {
|
||||
#[link_name = "SystemFunction036"]
|
||||
pub fn RtlGenRandom(randombuffer: *mut core::ffi::c_void, randombufferlength: u32) -> BOOLEAN;
|
||||
}
|
||||
#[link(name = "kernel32")]
|
||||
extern "system" {
|
||||
pub fn CloseHandle(hobject: HANDLE) -> BOOL;
|
||||
}
|
||||
#[link(name = "kernel32")]
|
||||
extern "system" {
|
||||
pub fn GetLastError() -> WIN32_ERROR;
|
||||
}
|
||||
#[link(name = "user32")]
|
||||
extern "cdecl" {
|
||||
pub fn wsprintfA(param0: PSTR, param1: PCSTR, ...) -> i32;
|
||||
}
|
||||
#[link(name = "ws2_32")]
|
||||
extern "system" {
|
||||
pub fn socket(af: i32, r#type: WINSOCK_SOCKET_TYPE, protocol: i32) -> SOCKET;
|
||||
}
|
||||
windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN);
|
||||
windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
|
||||
windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR);
|
||||
windows_targets::link!("user32.dll" "cdecl" fn wsprintfA(param0 : PSTR, param1 : PCSTR, ...) -> i32);
|
||||
windows_targets::link!("ws2_32.dll" "system" fn socket(af : i32, r#type : WINSOCK_SOCKET_TYPE, protocol : i32) -> SOCKET);
|
||||
pub type BCRYPT_ALG_HANDLE = *mut core::ffi::c_void;
|
||||
pub type BOOL = i32;
|
||||
pub type BOOLEAN = u8;
|
||||
|
|
|
@ -107,7 +107,7 @@ fn main() {
|
|||
],
|
||||
);
|
||||
|
||||
write_std(
|
||||
write_sys(
|
||||
&src.join("b_std.rs"),
|
||||
&[
|
||||
"Windows.Win32.Foundation.CloseHandle",
|
||||
|
@ -223,10 +223,6 @@ fn write_win(output: &Path, filter: &[&str]) {
|
|||
riddle(output, filter, &["flatten", "minimal"]);
|
||||
}
|
||||
|
||||
fn write_std(output: &Path, filter: &[&str]) {
|
||||
riddle(output, filter, &["flatten", "std", "minimal"]);
|
||||
}
|
||||
|
||||
fn write_no_inner_attr(output: &Path, filter: &[&str]) {
|
||||
riddle(
|
||||
output,
|
||||
|
|
Загрузка…
Ссылка в новой задаче