Skip to content

Commit

Permalink
Improve windows-bindgen for std usage (#2610)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Aug 16, 2023
1 parent f1b1edd commit 8f47253
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 3 additions & 1 deletion crates/libs/bindgen/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ where
}
if expand {
for args in crate::read_file_lines(&arg)? {
from_string(result, &args)?;
if !args.starts_with("//") {
from_string(result, &args)?;
}
}
} else if arg == "--etc" {
expand = true;
Expand Down
6 changes: 0 additions & 6 deletions crates/libs/bindgen/src/rust/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ pub fn gen_sys_handle(writer: &Writer, def: TypeDef) -> TokenStream {
Type::ISize if writer.std => quote! {
pub type #ident = *mut ::core::ffi::c_void;
},
Type::USize if writer.std => quote! {
#[cfg(target_pointer_width = "32")]
pub type #ident = u32;
#[cfg(target_pointer_width = "64")]
pub type #ident = u64;
},
underlying_type => {
let signature = writer.type_default_name(&underlying_type);

Expand Down
5 changes: 1 addition & 4 deletions crates/tests/standalone/src/b_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ pub type HANDLE = *mut ::core::ffi::c_void;
pub type HMODULE = *mut ::core::ffi::c_void;
pub type PCSTR = *const u8;
pub type PSTR = *mut u8;
#[cfg(target_pointer_width = "32")]
pub type SOCKET = u32;
#[cfg(target_pointer_width = "64")]
pub type SOCKET = u64;
pub type SOCKET = usize;
pub type WIN32_ERROR = u32;
pub type WINSOCK_SOCKET_TYPE = i32;
2 changes: 2 additions & 0 deletions crates/tools/core/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// These will use `windows-sys` style bindings.

--out crates/libs/core/src/imp/bindings.rs
--config flatten sys minimal

Expand Down
2 changes: 2 additions & 0 deletions crates/tools/core/com_bindings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// These will use `windows` style bindings and include COM APIs.

--out crates/libs/core/src/imp/com_bindings.rs
--config flatten minimal

Expand Down

0 comments on commit 8f47253

Please sign in to comment.