Module std::backtrace_rs::dbghelp

source ·
Expand description

A module to assist in managing dbghelp bindings on Windows

Backtraces on Windows (at least for MSVC) are largely powered through dbghelp.dll and the various functions that it contains. These functions are currently loaded dynamically rather than linking to dbghelp.dll statically. This is currently done by the standard library (and is in theory required there), but is an effort to help reduce the static dll dependencies of a library since backtraces are typically pretty optional. That being said, dbghelp.dll almost always successfully loads on Windows.

Note though that since we’re loading all this support dynamically we can’t actually use the raw definitions in winapi, but rather we need to define the function pointer types ourselves and use that. We don’t really want to be in the business of duplicating winapi, so we have a Cargo feature verify-winapi which asserts that all bindings match those in winapi and this feature is enabled on CI.

Finally, you’ll note here that the dll for dbghelp.dll is never unloaded, and that’s currently intentional. The thinking is that we can globally cache it and use it between calls to the API, avoiding expensive loads/unloads. If this is a problem for leak detectors or something like that we can cross the bridge when we get there.

Macros

Structs

Constants

Statics

Functions

  • Initialize all support necessary to access dbghelp API functions from this crate.

Type Definitions