本文整理汇总了C++中Assembler::GetBaseAsmRef方法的典型用法代码示例。如果您正苦于以下问题:C++ Assembler::GetBaseAsmRef方法的具体用法?C++ Assembler::GetBaseAsmRef怎么用?C++ Assembler::GetBaseAsmRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assembler
的用法示例。
在下文中一共展示了Assembler::GetBaseAsmRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EmitDebuggableAttribute
void AsmMan::EmitDebuggableAttribute(mdToken tkOwner)
{
mdToken tkCA;
Assembler* pAsm = (Assembler*)m_pAssembler;
mdToken tkTypeSpec, tkMscorlib, tkParamType;
BinStr *pbsSig = new BinStr();
BinStr* bsBytes = new BinStr();;
char* szName;
tkMscorlib = pAsm->m_fIsMscorlib ? 1 : pAsm->GetBaseAsmRef();
tkTypeSpec = pAsm->ResolveClassRef(tkMscorlib,"System.Diagnostics.DebuggableAttribute",NULL);
EmitAssemblyRefs(); // just in case we gained 'mscorlib' AsmRef in GetAsmRef above
BOOL fOldStyle = FALSE;
if(tkMscorlib == 1)
fOldStyle = (m_pAssembly->usVerMajor == 1);
else
{
AsmManAssembly *pAssembly = GetAsmRefByName("mscorlib");
_ASSERTE(pAssembly != NULL);
PREFIX_ASSUME(pAssembly != NULL);
fOldStyle = (pAssembly->usVerMajor == 1);
}
bsBytes->appendInt8(1);
bsBytes->appendInt8(0);
if(fOldStyle)
{
pbsSig->appendInt8(IMAGE_CEE_CS_CALLCONV_HASTHIS);
corEmitInt(pbsSig,2);
pbsSig->appendInt8(ELEMENT_TYPE_VOID);
pbsSig->appendInt8(ELEMENT_TYPE_BOOLEAN);
pbsSig->appendInt8(ELEMENT_TYPE_BOOLEAN);
//New to old: 0x101->(true,true),0x03->(true,false),0x103->(true,true)+warning
bsBytes->appendInt8(1);
bsBytes->appendInt8((pAsm->m_dwIncludeDebugInfo==0x03 ? 0 : 1));
if(pAsm->m_dwIncludeDebugInfo == 0x103)
{
report->warn("\nOption /DEBUG=IMPL is invalid for legacy DebuggableAttribute, /DEBUG used.\n" );
}
}
else
{
BinStr bsSigArg;
char buffer[80];
sprintf_s(buffer,80,
"%s%c%s",
"System.Diagnostics.DebuggableAttribute",
NESTING_SEP,
"DebuggingModes"
);
tkParamType = pAsm->ResolveClassRef(tkMscorlib,buffer, NULL);
bsSigArg.appendInt8(ELEMENT_TYPE_VALUETYPE);
unsigned cnt = CorSigCompressToken(tkParamType, bsSigArg.getBuff(5));
bsSigArg.remove(5 - cnt);
pbsSig->appendInt8(IMAGE_CEE_CS_CALLCONV_HASTHIS);
corEmitInt(pbsSig,1);
pbsSig->appendInt8(ELEMENT_TYPE_VOID);
pbsSig->append(&bsSigArg);
bsBytes->appendInt32(pAsm->m_dwIncludeDebugInfo);
}
bsBytes->appendInt8(0);
bsBytes->appendInt8(0);
szName = new char[16];
strcpy_s(szName,16,".ctor");
tkCA = pAsm->MakeMemberRef(tkTypeSpec,szName,pbsSig);
pAsm->DefineCV(new CustomDescr(tkOwner,tkCA,bsBytes));
}