I have a C# project and I need a C++ native code to interact with the C# code. To do so, I am using a C++/CLI class wrapper that will call a C++ class.
As far as I understand, if a C++ class has a ref
behind it's declaration, it's going to be compiled as managed code. And if it doesn't have it, it will be compiled as native code.
Is this assumption correct or do I need to give the compiler further instructions to assure that my class will be native code?
As far as I understand, if a C++ class has a ref behind it's declaration, it's going to be compiled as managed code.
Correct. ref class
types cannot be compiled without /clr
.
And if it doesn't have it, it will be compiled as native code.
Incorrect. If /clr
is in effect (e.g. not disabled by #pragma unmanaged
) then the compiler is only generating MSIL (Microsoft intermediate language, the bytecode for .NET).