C ++/CLI编译器如何 [英] How does the C++/CLI compiler

查看:116
本文介绍了C ++/CLI编译器如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道C ++/CLI编译器是如何工作的,我在C ++/CLI中生成了一个简单代码的5个树转储

我使用此简单代码(纯净,安全的CLR)生成了3个树转储:


Hi, I whant to know, how the C++/CLI compiler works, I generate 5 tree dumps of one simple code in C++/CLI

3 tree dumps I generate with this simple code ( pure, safe CLR):


using namespace System;

int main(array<System::String ^> ^args)
{
    Console::WriteLine(L"Hello World");
    return 0;
}



因此,但是,当我使用"printf"编译代码时... CLR和PURE生成的代码使用以下指令:



so, but, when I compile the code with a '' printf ''... the code generate of CLR and PURE use this instruction:

|___[STM] printf : vararg int32 modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)(int8 modopt([mscorlib]System.Runtime.CompilerServices.IsSignUnspecifiedByte) modopt([mscorlib]System.Runtime.CompilerServices.IsConst)*)



IL代码生成是这样的:



The IL code generate is this:

//000008: 	printf("Ola mundo\n");
  IL_000a:  /* 7F   | (04)000001       */ ldsflda    valuetype '<CppImplementationDetails>'.$ArrayType$$$BY0L@$$CBD/*02000002*/ modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsConst/*01000002*/) '?A0x1af50272.unnamed-global-0' /* 04000001 */
  IL_000f:  /* 28   | (0A)000004       */ call       vararg int32 modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.CallConvCdecl/*01000001*/) printf(int8 modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsSignUnspecifiedByte/*01000006*/) modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsConst/*01000002*/)*) /* 0A000004 */
  IL_0014:  /* 26   |                  */ pop




因此,在尝试开发这种样式的编译器时,我发现了一个名为NetGnu的名为pnetC的编译器,该编译器将C本机代码与MSIL混合使用,但是,该编译器使用一个包含所有.h文件的dll ...

因此,我想了解这种编译器样式的技术信息,如何生成此混合代码?

因此,基本上,我需要对此有意识形态,并需要有关此方面的技术信息...

谢谢
Alexandre




So, In my attempt of development of one compiler with this style, I found one compiler called pnetC, of NetGnu, this compile mix C Native code with MSIL,but, the compiler use one dll with all .h files...

So, I would like techniques information of this compiler style, how I can generate this mixed code ?

So, basically, I need ideias for this, and technical informations of this...

Thanks
Alexandre

推荐答案

ArrayType
ArrayType


BY0L @


CBD/* 02000002 */modopt ([mscorlib/* 23000001 */] System.Runtime.CompilerServices.IsConst/* 01000002 */)'?A0x1af50272.unnamed-global-0'/* 04000001 */ IL_000f:/* 28 | (0A)000004 */调用vararg int32 modopt([mscorlib/* 23000001 */] System.Runtime.CompilerServices.CallConvCdecl/* 01000001 */)printf(int8 modopt([mscorlib/* 23000001 */] System.Runtime.CompilerServices .IsSignUnspecifiedByte/* 01000006 */)modopt([mscorlib/* 23000001 */] System.Runtime.CompilerServices.IsConst/* 01000002 */)*)/* 0A000004 */ IL_0014:/* 26 | */pop
CBD/*02000002*/ modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsConst/*01000002*/) '?A0x1af50272.unnamed-global-0' /* 04000001 */ IL_000f: /* 28 | (0A)000004 */ call vararg int32 modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.CallConvCdecl/*01000001*/) printf(int8 modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsSignUnspecifiedByte/*01000006*/) modopt([mscorlib/*23000001*/]System.Runtime.CompilerServices.IsConst/*01000002*/)*) /* 0A000004 */ IL_0014: /* 26 | */ pop




因此,在尝试开发这种样式的编译器时,我发现了一个名为NetGnu的名为pnetC的编译器,该编译器将C本机代码与MSIL混合使用,但是,该编译器使用一个包含所有.h文件的dll ...

因此,我想了解这种编译器样式的技术信息,如何生成此混合代码?

因此,基本上,我需要对此有意识形态,并需要有关此方面的技术信息...

谢谢
亚历山大(Alexandre)




So, In my attempt of development of one compiler with this style, I found one compiler called pnetC, of NetGnu, this compile mix C Native code with MSIL,but, the compiler use one dll with all .h files...

So, I would like techniques information of this compiler style, how I can generate this mixed code ?

So, basically, I need ideias for this, and technical informations of this...

Thanks
Alexandre


这篇关于C ++/CLI编译器如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆