Let me clarify what I mean by 'normal' C++ first- I'm currently reading Walter Savitch's "Problem Solving in C++". As far as I am aware this is not written specifically for Microsoft or Unix. So my question is, how does what I am learning in this book (which I am using for my universal knowledge-gaining of c++) differ from what I keep reading about CLI C++?
Is CLI C++ just what I would encounter if I used Visual C++? I'm totally confused.
C++ runs directly as binary complied for your hardware. C++ cli is a c++ extension that is used to interface with the MS common language runtime. It complies to IL normally and is executed inside the . net runtime.
By using C++/CLI you can create C++ programs that use . NET classes as well as native C++ types. C++/CLI is intended for use in console applications and in DLLs that wrap native C++ code and make it accessible from . NET programs.
gcnew is an operator, just like the new operator, except you don't need to delete anything created with it; it's garbage collected. You use gcnew for creating . Net managed types, and new for creating unmanaged types.
C++/CLI, (Also sometimes C++/CLR) refers to a language which is positioned somewhere in between native C++, and the .NET framework.
It's usually used for applications where you need to bridge some native code (pure C++) and managed code (Like VB, C#, F#, etc).
C++/CLI is a much different beast than regular C++ though. And when people say Visual C++, the meaning can vary depending on context. Sometimes they mean C++ with the common language runtime (CLR) layer enabled, other times they mean just plain C++. It's unfortunate that there's a lot of different terminology out there, and a lot of misnomers, but what can you do?
C++ and C++/CLI differ greatly. C++/CLI is the managed .NET-version of C++, made by Microsoft to enable a layer from .NET to native code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With