Attribute Macro ctor::dtor

source · []
#[dtor]
Expand description

Marks a function as a library/executable destructor. This uses OS-specific linker sections to call a specific function at termination time.

Multiple shutdown functions are supported, but the invocation order is not guaranteed.

sys_common::at_exit is usually a better solution for shutdown handling, as it allows you to use stdout in your handlers.


#[dtor]
fn shutdown() {
  /* ... */
}