IDiaSession::symbolById
Retrieves a symbol by its unique identifier.
Syntax
HRESULT symbolById (
DWORD id,
IDiaSymbol** ppSymbol
);
Parameters
id
[in] Unique identifier.
ppSymbol
[out] Returns an IDiaSymbol object that represents the symbol retrieved.
Return Value
If successful, returns S_OK
; otherwise, returns an error code.
Remarks
The specified identifier is a unique value used internally by the DIA SDK to make all symbols unique.
This method can be used, for example, to retrieve the symbol representing the type of another symbol (see the example).
Example
This example retrieves an IDiaSymbol representing the type of another symbol. This example shows how to use the symbolById
method in the session. A simpler approach is to call the IDiaSymbol::get_type method to retrieve the type symbol directly.
IDiaSymbol *GetSymbolType(IDiaSymbol *pSymbol, IDiaSession *pSession)
{
IDiaSymbol *pTypeSymbol = NULL;
if (pSymbol != NULL && pSession != NULL)
{
DWORD symbolTypeId;
pSymbol->get_typeId(&symbolTypeId);
pSession->symbolById(symbolTypeId, &pTypeSymbol);
}
return(pTypeSymbol);
}