Chapter 1.4. Working with Managed Extensions to C++

IN THIS CHAPTER

In the previous chapter we looked briefly at managed extensions to C++ as a way to use your C++ skills, either in the managed environment of .NET or as a vehicle for reusing your existing code. If you're the typical C++ programmer looking at migration to .NET, the questions foremost in your mind will be “Can I protect my investment in all that C++ code?” and “Can I use C++ and C# together easily?” Thankfully, due to the efforts of the Microsoft engineers, both of these questions have positive answers. Let's take a short sidetrip into managed extensions to C++ and get a feel for where your old code can fit into the new world of .NET.

The managed extensions add a few keywords to the C++ language. Obviously this is not going to amuse language lawyers the world over, but remember that in reality, managed C++ is not an attempt to corrupt ANSI specifications but a compromise that allows many of the benefits of the managed runtime without the pain of having to learn a whole new language. As an aside, the Visual Studio.NET C++ compiler is actually more ANSI compliant than its predecessors when used in native C++ mode. When used to compile ordinary C++ code, the compiler generates x86 object code for linking in the normal manner. When used to compile managed C++, the /CLR command-line argument is used, and the compiler creates IL instead.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.105.72