2.100 Pragma Linker_Destructor

Syntax:

pragma Linker_Destructor (procedure_LOCAL_NAME);

procedure_LOCAL_NAME must refer to a parameterless procedure that is declared at the library level. A procedure to which this pragma is applied will be treated as a finalization routine by the linker. It is equivalent to __attribute__((destructor)) in GNU C and causes procedure_LOCAL_NAME to be invoked after the entry point of the executable has exited (or immediately before the shared library is unloaded if the procedure is linked in a shared library), in particular after the Ada run-time environment is shut down.

See pragma Linker_Constructor for the set of restrictions that apply because of these specific contexts.