Pure and verifiable code (C++/CLI)
For .NET Programming, Visual C++ in Visual Studio 2017 supports the creation of mixed assemblies by using the /clr (Common Language Runtime Compilation) compiler option. The /clr:pure and clr:safe options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017. If your code needs to be safe or verifiable, then we recommend that you port it to C#.
Mixed assemblies (compiled with /clr), contain both unmanaged and managed parts, making it possible for them to use .NET features, but still contain native code. This allows applications and components to be updated to use .NET features without requiring that the entire project be rewritten. Using Visual C++ to mix managed and native code in this fashion is called C++ Interop. For more information, see Mixed (Native and Managed) Assemblies and Native and .NET Interoperability.
Calls made from managed assemblies to native DLLs via P/Invoke will compile, but may fail at runtime depending on security settings.
There is one coding scenario that will pass the compiler but that will result in an unverifiable assembly: calling a virtual function through an object instance using the scope resolution operator. For example:
MyObj -> A::VirtualFunction();.
Send feedback about: