RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Linker::SymbolName Class Reference

Represents an (imported or internal) symbol name, which can be more complex than a string. More...

#include <symbol.h>

Public Member Functions

 SymbolName (std::string name)
 Creates an internal symbol with a name.
 
 SymbolName (std::string library, std::string name)
 Creates a symbol imported via name, from a library.
 
 SymbolName (std::string library, std::string name, uint16_t hint)
 Creates a symbol imported via name and a hint, from a library.
 
 SymbolName (std::string library, uint16_t ordinal)
 Creates a symbol imported via ordinal, from a library.
 
bool LoadName (std::string &result) const
 Retrieves the name of the symbol, if it has one.
 
bool LoadLibraryName (std::string &result) const
 Retrieves the name of the library, if it is imported.
 
bool LoadOrdinalOrHint (uint16_t &result) const
 Retrieves the ordinal of symbols imported by ordinal, or the hint for imported symbols with a hint.
 
bool GetLocalName (std::string &result) const
 For local symbols, returns the name.
 
bool GetImportedName (std::string &result_library, std::string &result_name) const
 For symbols imported by name, returns the library and name.
 
bool GetImportedName (std::string &result_library, std::string &result_name, uint16_t &result_hint) const
 For symbols imported by name, returns the library, name and hint (or zero if no hint is present)
 
bool GetImportedOrdinal (std::string &result_library, uint16_t &result_ordinal) const
 For symbols imported by ordinal, returns the library and ordinal.
 
bool operator== (const SymbolName &other) const
 Compares two symbols for equality.
 
bool operator!= (const SymbolName &other) const
 Compares two symbols for inequality.
 

Protected Attributes

std::optional< std::string > library
 
std::optional< std::string > name
 
std::optional< uint16_t > hint
 

Detailed Description

Represents an (imported or internal) symbol name, which can be more complex than a string.

When referencing symbols, usually a string identifier is sufficient. Some output formats, in particular the NE, LE and PE formats, need to store more information with the symbol, including the library it is imported from, and potentially a 16-bit integer ordinal or hint.

Constructor & Destructor Documentation

◆ SymbolName() [1/2]

Linker::SymbolName::SymbolName ( std::string library,
std::string name,
uint16_t hint )
inline

Creates a symbol imported via name and a hint, from a library.

This is expected to be used for the PE format.

◆ SymbolName() [2/2]

Linker::SymbolName::SymbolName ( std::string library,
uint16_t ordinal )
inline

Creates a symbol imported via ordinal, from a library.

This is used by formats like NE, LE, PE.


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