C++ CLI Correct way to use #pragma managed / unmanaged

后端 未结 2 384
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-16 14:40

I\'m writing a C++ / CLI application, but I want most of the code in my C++ DLL to run natively (i.e. not managed).

I have only got a single CLI class in the module,

2条回答
  •  独厮守ぢ
    2020-12-16 15:12

    You don't have to jump through hoops to ensure this. The compiler will only ever emit IL when it compiles your program with the /clr option turned on. It looks like a project option but it is not.

    Just select your .cpp files that contain native code. Select more than one of them by holding down the Ctrl key and clicking the file in the Explorer windows. Right-click + Properties, C/C++, General. Change the "Common Language Runtime Support" setting to "No...".

提交回复
热议问题