Hi im on the process of learning c++/cli and to this end reading the book expert c++/cli. in the book the author states "The compiler option /clr:pure still allows you to compile existing C++ code to managed code (source code compatibility)". does this mean existing native codes where objects that are being initialized in the CRT heap can be recompiled using /clr:pure ?
UPDATE 1: For example Can Class B compiled with /clr:pure?.
Class A {
Public :
A()
{
}
~A()
{
}
void Foo()
{
}
};
Class B {
Public :
A* test;
B()
{
test = new A();
test->Foo();
}
~B()
{
delete test;
}
};
MSDN states that
Pure assemblies (compiled with /clr:pure) can contain both native and managed data types, but only managed functions
and
/clr:pure
Produces a Microsoft Intermediate Language (MSIL)-only output file that has no native executable code. However, it can contain native types compiled to MSIL.
From my understanding ( i may be wrong here) test = new A(); produces native code thus cannot be compiled with /clr:pure. If I am wrong can any one give me a example of
- A native function (as MSDN states only managed functions are allowed)
- An example of a class that can be compiled with a /clr and not with /clr:pure
Thanks
/clr:pure
is in effect, all functions are managed. Note that you're still using native library calls -- with/clr:pure
those will be performed using p/invoke instead of IJW C++ interop. – Ben Voigt