omni::extras::ForceSymbolLink
Defined in omni/extras/ForceLink.h
-
class ForceSymbolLink
Helper class to force the linking of a C++ symbol.
This is done by having the symbol’s address be passed to a function in another module. Since, at link time, the linker doesn’t know what the other module’s function will do with the symbol, it can’t discard the symbol. This is useful for ensuring that debug-only or initializer-only symbols do not get unintentionally eliminated from the module they are present in.
Note that since this does not have any data members, it shouldn’t occupy any space in the module’s data section. It will however generate a C++ static initializer and shutdown destructor.
This class should not be used directly, but instead through the OMNI_FORCE_SYMBOL_LINK macro.
Public Functions
-
inline ForceSymbolLink(void *ptr)
Constructor: passes an argument’s value to a system library.
- Parameters
ptr – [in] The address to pass on to a system library call. This prevents the linker from being able to discard the symbol as unused or unreferenced. This value is not accessed as a pointer in any way so any value is acceptable.
- Returns
No return value.
-
inline ForceSymbolLink(void *ptr)