You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust on Windows has to call SymInitializeW before generating a backtrace, and it doesn't call SymCleanup afterward. If AddressInfoObtainer is then used, it calls SymInitializeW again, which fails because it has already been called.
Example code (set RUSTBACKTRACE=1):
use std::panic::catch_unwind;use dlopen::raw::{AddressInfoObtainer,Library};fnmain(){let library = Library::open("example.dll").unwrap();let pointer:*const() = unsafe{ library.symbol("foo")}.unwrap();catch_unwind(|| panic!());// this generates a backtrace. Backtrace::capture() probably works too// Panics because SymInitializeW returns an errorAddressInfoObtainer::new().obtain(pointer).unwrap();}
There is some background on how the backtrace crate handled a similar conflict here (also explains why Rust doesn't call SymCleanup).
I think dlopen should:
Call SymInitializeW but ignore its return value
Never call SymCleanup
This behavior is awkward, but I think it's the only way to be compatible with how Rust uses SymInitializeW.
I can submit a PR for this if it's welcome.
The text was updated successfully, but these errors were encountered:
Rust on Windows has to call
SymInitializeW
before generating a backtrace, and it doesn't callSymCleanup
afterward. IfAddressInfoObtainer
is then used, it callsSymInitializeW
again, which fails because it has already been called.Example code (set
RUSTBACKTRACE=1
):There is some background on how the backtrace crate handled a similar conflict here (also explains why Rust doesn't call
SymCleanup
).I think dlopen should:
SymInitializeW
but ignore its return valueSymCleanup
This behavior is awkward, but I think it's the only way to be compatible with how Rust uses
SymInitializeW
.I can submit a PR for this if it's welcome.
The text was updated successfully, but these errors were encountered: