本文整理汇总了C#中ILCompiler.DependencyAnalysis.ObjectDataBuilder.EmitByte方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectDataBuilder.EmitByte方法的具体用法?C# ObjectDataBuilder.EmitByte怎么用?C# ObjectDataBuilder.EmitByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILCompiler.DependencyAnalysis.ObjectDataBuilder
的用法示例。
在下文中一共展示了ObjectDataBuilder.EmitByte方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
Encoding encoding = UTF8Encoding.UTF8;
ObjectDataBuilder objDataBuilder = new ObjectDataBuilder(factory);
AsmStringWriter stringWriter = new AsmStringWriter((byte b) => objDataBuilder.EmitByte(b));
stringWriter.WriteString(_data);
objDataBuilder.DefinedSymbols.Add(this);
return objDataBuilder.ToObjectData();
}
示例2: GetData
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
{
ObjectDataBuilder builder = new ObjectDataBuilder(factory);
builder.Alignment = factory.Target.PointerSize;
builder.DefinedSymbols.Add(this);
// Don't bother sorting if we're not emitting the contents
if (!relocsOnly)
_items.Sort((x, y) => Comparer<int>.Default.Compare((int)x.Id, (int)y.Id));
// ReadyToRunHeader.Magic
builder.EmitInt((int)(ReadyToRunHeaderConstants.Signature));
// ReadyToRunHeader.MajorVersion
builder.EmitShort((short)(ReadyToRunHeaderConstants.CurrentMajorVersion));
builder.EmitShort((short)(ReadyToRunHeaderConstants.CurrentMinorVersion));
// ReadyToRunHeader.Flags
builder.EmitInt(0);
// ReadyToRunHeader.NumberOfSections
var sectionCountReservation = builder.ReserveShort();
// ReadyToRunHeader.EntrySize
builder.EmitByte((byte)(8 + 2 * factory.Target.PointerSize));
// ReadyToRunHeader.EntryType
builder.EmitByte(1);
int count = 0;
foreach (var item in _items)
{
// Skip empty entries
if (item.Node.ShouldSkipEmittingObjectNode(factory))
continue;
builder.EmitInt((int)item.Id);
ModuleInfoFlags flags = 0;
if (item.EndSymbol != null)
{
flags |= ModuleInfoFlags.HasEndPointer;
}
builder.EmitInt((int)flags);
builder.EmitPointerReloc(item.StartSymbol);
if (item.EndSymbol != null)
{
builder.EmitPointerReloc(item.EndSymbol);
}
else
{
builder.EmitZeroPointer();
}
count++;
}
builder.EmitShort(sectionCountReservation, checked((short)count));
return builder.ToObjectData();
}