# ctor::dtor - Rust
Marks a function as a library/executable destructor. This uses OS-specific linker sections to call a specific function at termination time.
Keywords: rust, rustlang, rust-lang, dtor

# Attribute Macro ctor::dtor [−] [src]

    #[dtor]

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() {
      /* ... */
    }