Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Creates a type from the specified primitive type.
[C++]
HRESULT CreateTypeFromPrimitive(
   DWORD          dwPrimType,
   IDebugAddress* pAddress,
   IDebugField**  ppType
);
[C#]
int CreateTypeFromPrimitive(
   uint          dwPrimType,
   IDebugAddress pAddress,
   IDebugField   ppType
);
Parameters
- dwPrimType 
 [in] Value from the CorElementType Enumeration that represents the primitive type.
- pAddress 
 [in] An address object represented by an IDebugAddress interface.
- ppType 
 [in] Returns an IDebugField object that describes the type.
Return Value
If successful, returns S_OK; otherwise, returns an error code.
Example
The following example shows how to implement this method for a CDebugSymbolProvider object that exposes the IDebugComPlusSymbolProvider interface.
HRESULT CDebugSymbolProvider::CreateTypeFromPrimitive(
    DWORD dwPrimType,
    IDebugAddress* pAddress,
    IDebugField** ppType)
{
    HRESULT hr = S_OK;
    CDEBUG_ADDRESS addr;
    const COR_SIGNATURE* pTypeInfo = (const COR_SIGNATURE*) & dwPrimType;
    CDebugGenericParamScope* pGenScope = NULL;
    //
    // This function will only work for primitive types
    //
    METHOD_ENTRY( CDebugSymbolProvider::CreateTypeFromPrimitive );
    IfFailGo( pAddress->GetAddress( &addr ) );
    IfNullGo( pGenScope = new CDebugGenericParamScope(addr.GetModule(), addr.tokClass, addr.GetMethod()), E_OUTOFMEMORY );
    IfFailGo( CreateType( pTypeInfo,
                          1,
                          addr.GetModule(),
                          addr.GetMethod(),
                          pGenScope,
                          ppType ) );
    METHOD_EXIT( CDebugSymbolProvider::CreateTypeFromPrimitive, hr );
Error:
    RELEASE( pGenScope );
    return hr;
}