当前位置: 首页>>代码示例>>C++>>正文


C++ Assembler::EmitCustomAttributes方法代码示例

本文整理汇总了C++中Assembler::EmitCustomAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ Assembler::EmitCustomAttributes方法的具体用法?C++ Assembler::EmitCustomAttributes怎么用?C++ Assembler::EmitCustomAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assembler的用法示例。


在下文中一共展示了Assembler::EmitCustomAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WszMultiByteToWideChar

void    AsmMan::EmitFiles()
{
    AsmManFile* tmp;
    Assembler* pAsm = (Assembler*)m_pAssembler;
    int i;
    HRESULT                 hr = S_OK;
    mdToken tk;
    for(i = 0; (tmp=m_FileLst.PEEK(i)) != NULL; i++)
    {
        BOOL    fEntry = ((tmp->dwAttr & 0x80000000)!=0);

        wzUniBuf[0] = 0;

        BYTE*       pHash=NULL;
        DWORD       cbHash= 0;

        if(!tmp->m_fNew) continue;
        tmp->m_fNew = FALSE;

        WszMultiByteToWideChar(g_uCodePage,0,tmp->szName,-1,wzUniBuf,dwUniBuf);
        if(tmp->pHash==NULL) // if hash not explicitly specified
        {
            if(m_pAssembly      // and assembly is defined
                && m_pAssembly->ulHashAlgorithm) // and hash algorithm is defined...
            { // then try to compute it
                {
                    pHash = NULL;
                    cbHash = 0;
                }
            }
        }
        else 
        {
            pHash = tmp->pHash->ptr();
            cbHash = tmp->pHash->length();
        }

        hr = m_pAsmEmitter->DefineFile(wzUniBuf,
                                    (const void*)pHash,
                                    cbHash,
                                    tmp->dwAttr & 0x7FFFFFFF,
                                    (mdFile*)&tk);
        _ASSERTE(tk == tmp->tkTok);
        if(FAILED(hr)) report->error("Failed to define file '%s': 0x%08X\n",tmp->szName,hr);
        else
        {
            if(fEntry)
            {
                if (FAILED(pAsm->m_pCeeFileGen->SetEntryPoint(pAsm->m_pCeeFile, tmp->tkTok)))
                {
                    pAsm->report->error("Failed to set external entry point for file '%s'\n",tmp->szName);
                }
            }
            pAsm->EmitCustomAttributes(tmp->tkTok, &(tmp->m_CustomDescrList));
        }
    } //end for(i = 0; tmp=m_FileLst.PEEK(i); i++)
}
开发者ID:DrewScoggins,项目名称:coreclr,代码行数:57,代码来源:asmman.cpp

示例2: FillAssemblyMetadata

void    AsmMan::EmitAssembly()
{
    HRESULT                 hr = S_OK;
    ASSEMBLYMETADATA md;
            
    wzUniBuf[0] = 0;
    if(m_pAssembly == NULL) return;
    if(!m_pAssembly->m_fNew) return;
    m_pAssembly->m_fNew = FALSE;

    FillAssemblyMetadata(m_pAssembly, &md);

    // Convert name to Unicode
    WszMultiByteToWideChar(g_uCodePage,0,m_pAssembly->szName,-1,wzUniBuf,dwUniBuf);

    hr = m_pAsmEmitter->DefineAssembly(              // S_OK or error.
        (const void*)(m_sStrongName.m_pbPublicKey), // [IN] Public key of the assembly.
        m_sStrongName.m_cbPublicKey,                // [IN] Count of bytes in the public key.
        m_pAssembly->ulHashAlgorithm,            // [IN] Hash algorithm used to hash the files.
        (LPCWSTR)wzUniBuf,                 // [IN] Name of the assembly.
        (const ASSEMBLYMETADATA*)&md,  // [IN] Assembly MetaData.
        m_pAssembly->dwAttr,        // [IN] Flags.
        (mdAssembly*)&(m_pAssembly->tkTok));             // [OUT] Returned Assembly token.

    if(FAILED(hr)) report->error("Failed to define assembly '%s': 0x%08X\n",m_pAssembly->szName,hr);
    else
    {
        Assembler* pAsm = ((Assembler*)m_pAssembler);
        pAsm->EmitSecurityInfo(m_pAssembly->tkTok,
                             m_pAssembly->m_pPermissions,
                             m_pAssembly->m_pPermissionSets);
        if(pAsm->m_dwIncludeDebugInfo)
        {
            EmitDebuggableAttribute(m_pAssembly->tkTok);
        }
        pAsm->EmitCustomAttributes(m_pAssembly->tkTok, &(m_pAssembly->m_CustomDescrList));
    }
}
开发者ID:Anupam-,项目名称:shared-source-cli-2.0,代码行数:38,代码来源:asmman.cpp


注:本文中的Assembler::EmitCustomAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。