Skip to content

Commit

Permalink
Conditionally define windows functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingosse committed Feb 20, 2025
1 parent 3ab5db5 commit 84f0d6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions crashtracker-ffi/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ after_includes = """
"""

[defines]
"target_os = windows" = "_WIN32"

[export]
prefix = "ddog_crasht_"
renaming_overrides_prefixing = true
Expand Down
7 changes: 4 additions & 3 deletions crashtracker-ffi/src/collector_windows/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use windows::Win32::System::Threading::{GetProcessId, GetThreadId, OpenThread, T

#[no_mangle]
#[must_use]
#[cfg(target_os = "windows")]
/// Initialize the crash-tracking infrastructure.
///
/// # Preconditions
Expand Down Expand Up @@ -205,7 +206,7 @@ pub struct WerContext {
}

#[no_mangle]
#[cfg(windows)]
#[cfg(target_os = "windows")]
pub unsafe extern "C" fn ddog_crasht_event_signature_callback(
_context: *const c_void,
_exception_information: *const WER_RUNTIME_EXCEPTION_INFORMATION,
Expand All @@ -220,7 +221,7 @@ pub unsafe extern "C" fn ddog_crasht_event_signature_callback(
}

#[no_mangle]
#[cfg(windows)]
#[cfg(target_os = "windows")]
pub unsafe extern "C" fn ddog_crasht_debugger_launch_callback(
_context: *const c_void,
_exception_information: *const WER_RUNTIME_EXCEPTION_INFORMATION,
Expand All @@ -234,7 +235,7 @@ pub unsafe extern "C" fn ddog_crasht_debugger_launch_callback(
}

#[no_mangle]
#[cfg(windows)]
#[cfg(target_os = "windows")]
pub unsafe extern "C" fn ddog_crasht_exception_event_callback(
context: *const c_void,
exception_information: *const WER_RUNTIME_EXCEPTION_INFORMATION,
Expand Down

0 comments on commit 84f0d6d

Please sign in to comment.