Skip to content

Commit

Permalink
Remove the windows-sys dependency (#60)
Browse files Browse the repository at this point in the history
* Remove the windows-sys dependency

* Fix build.rs

Co-authored-by: Jake Shadle <[email protected]>
  • Loading branch information
gabrielesvelto and Jake-Shadle authored Oct 26, 2022
1 parent ef6c87d commit 18d57a8
Show file tree
Hide file tree
Showing 7 changed files with 628 additions and 56 deletions.
13 changes: 0 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ nix = { version = "0.25", default-features = false, features = [
"user",
] }

[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
version = "0.42"
features = [
# MiniDumpWriteDump requires...a lot of features
"Win32_Foundation",
"Win32_Storage_FileSystem",
"Win32_System_Diagnostics_Debug",
"Win32_System_Kernel",
"Win32_System_Memory",
# GetCurrentThreadId & OpenProcess
"Win32_System_Threading",
]

[target.'cfg(target_os = "macos")'.dependencies]
# Binds some additional mac specifics not in libc
mach2 = "0.4"
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fn main() {
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
println!("cargo:rustc-link-lib=dylib=dbghelp");
}
}
9 changes: 5 additions & 4 deletions src/bin/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,13 @@ mod linux {

#[cfg(target_os = "windows")]
mod windows {
use minidump_writer::ffi::{
GetCurrentProcessId, GetCurrentThread, GetCurrentThreadId, GetThreadContext, CONTEXT,
EXCEPTION_POINTERS, EXCEPTION_RECORD,
};

use super::*;
use std::mem;
use windows_sys::Win32::System::{
Diagnostics::Debug::{GetThreadContext, CONTEXT, EXCEPTION_POINTERS, EXCEPTION_RECORD},
Threading::{GetCurrentProcessId, GetCurrentThread, GetCurrentThreadId},
};

#[inline(never)]
pub(super) fn real_main(args: Vec<String>) -> Result<()> {
Expand Down
1 change: 1 addition & 0 deletions src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod errors;
pub mod ffi;
pub mod minidump_writer;
Loading

0 comments on commit 18d57a8

Please sign in to comment.