Constructors and DestructorsΒΆ
API for Metal constructors and destructors
Defines
-
METAL_INIT_HIGHEST_PRIORITY
-
METAL_INIT_DEFAULT_PRIORITY
-
METAL_INIT_LOWEST_PRIORITY
-
METAL_CONSTRUCTOR
(function_name) Define a Metal constructor.
Functions defined with METAL_CONSTRUCTOR will be added to the list of Metal constructors. By default, these functions are called before main by the metal_init() function.
-
METAL_CONSTRUCTOR_PRIO
(function_name, priority) Define a Metal constructor with a given priority.
The priority argument should be an integer between 0 and 9999, where 0 is the highest priority (runs first) and 9999 is the lowest priority (runs last).
Functions defined with METAL_CONSTRUCTOR_PRIO will be added to the list of Metal constructors. By default, these functions are called before main by the metal_init() function.
-
METAL_DESTRUCTOR
(function_name) Define a Metal destructor.
Functions defined with METAL_DESTRUCTOR will be added to the list of Metal destructors. By default, these functions are called on exit by the metal_fini() function.
-
METAL_DESTRUCTOR_PRIO
(function_name, priority) Define a Metal destructor with a given priority.
The priority argument should be an integer between 0 and 9999, where 0 is the highest priority (runs first) and 9999 is the lowest priority (runs last).
Functions defined with METAL_DESTRUCTOR_PRIO will be added to the list of Metal destructors. By default, these functions are called on exit by the metal_fini() function.
Typedefs
-
typedef void (*
metal_constructor_t
)(void)
-
typedef void (*
metal_destructor_t
)(void)
Functions
-
void
metal_init
(void) Call all Metal constructors.
Devices supported by Metal may define Metal constructors to perform initialization before main. This function iterates over the constructors and calls them in turn.
You can add your own constructors to the functions called by metal_init() by defining functions with the METAL_CONSTRUCTOR() macro.
This function is called before main by default by metal_init_run().
-
void
metal_fini
(void) Call all Metal destructors.
Devices supported by Metal may define Metal destructors to perform initialization on exit. This function iterates over the destructors and calls them in turn.
You can add your own destructors to the functions called by metal_fini() by defining functions with the METAL_DESTRUCTOR() macro.
This function is called on exit by default by metal_fini_run().
-
void
metal_init_run
(void) Weak function to call metal_init() before main.
This function calls metal_init() before main by default. If you wish to replace or augment this call to the Metal constructors, you can redefine metal_init_run()
-
void
metal_fini_run
(void) Weak function to call metal_fini() before main.
This function calls metal_fini() at exit by default. If you wish to replace or augment this call to the Metal destructors, you can redefine metal_fini_run()