Pigweed
 
Loading...
Searching...
No Matches
pw::LinkerSymbol< T > Class Template Reference

#include <linker_symbol.h>

Public Member Functions

 LinkerSymbol (const LinkerSymbol &)=delete
 
 LinkerSymbol (const LinkerSymbol &&)=delete
 
LinkerSymboloperator= (const LinkerSymbol &)=delete
 
LinkerSymboloperator= (const LinkerSymbol &&)=delete
 
value () const
 Gets the value of this linker symbol, converted to the specified type.
 

Detailed Description

template<class T = uintptr_t>
class pw::LinkerSymbol< T >

Represents a symbol provided by the linker, i.e. via a linker script.

LinkerSymbol objects are used with linker-provided symbols that don't have storage (which is common), and only provide a value e.g.

MY_LINKER_VARIABLE = 42

LinkerSymbol objects are not actual variables (do not have storage) and thus cannot be created; they can only be used with an extern "C" declaration. The purpose is to communicate values from the linker script to C++ code.

Example:

#include "pw_build/linker_symbol.h"
extern "C" pw::LinkerSymbol<uint32_t> MY_LINKER_VARIABLE;
uint32_t GetMyLinkerVariable() {
return MY_LINKER_VARIABLE.value();
}
Definition: linker_symbol.h:52
T value() const
Gets the value of this linker symbol, converted to the specified type.
Definition: linker_symbol.h:62
Template Parameters
TThe type of the value communicated by the linker, defaulting to uintptr_t. Must be an integral or enum type, no larger than uintptr_t.

The documentation for this class was generated from the following file: