Native C++ and .NET - things are getting better!

Many years ago I developed in C and C++. Once I joined Microsoft most of my dev time switched to Visual Basic and more recently C#. What about the ISVs I worked with during the same period? Most did Visual Basic with a small amount of C++ (maybe a few ActiveX controls or some low level work). With the advent of the .NET Framework many of these folks are now happily writing new code in Visual Basic.NET and C#. What about C++?

 

There has always been a steam of companies that I have met that use C++ for nearly 100% of their application. The reasons are varied. Some started work before Visual Basic "grew up", some came from Unix backgrounds, some needed very low level access to the OS or needed the very best performance. I find these companies typically feel a little uneasy when they look at what we delivered in VS.NET and the comparative difficulties of doing managed code development in the new C++ compiler vs Visual Basic.NET and C#.

 

I am very pleased to report that we are addressing these concerns head on in Visual Studio.NET 2005. Yesterday I sat through a session with one of the lead program managers from the Visual C++ team. With the upcoming release we make writing managed code in C++ so much sweeter - much of the clunkyness has gone (The double underscore goes away!) and indeed in some areas C++ now does a "better" job of writing managed code than C# or Visual Basic.NET. Very welcome indeed. Check out these two articles to find out more:

The bit that really blew me away was the demo. The presenter and one other member of the team had taken the full code drop of Powerpoint on a Friday eve and by Monday had it entirely recompiled as managed code targeting the clr (Using the /clr compiler switch). They had also extended it to take advantage of WinForms to add a great new feature whilst only needing to modify a handful of lines of code in the original source. Very impressive.

 

With Visual Studio.NET 2005 we enable:

  • WinForm controls hosted inside MFC
  • WinForm forms as dialogues
  • WinForm controls as an MFC Cview

Check out the docs on /clr in Visual Studio.NET 2003. In Visual C++ 2005 ("Whidbey"), the process of retargeting existing source code with /clr is made easier and more powerful, with less programmer attention required.

 

So if you are an ISV with a large base of C++ code then maybe now is a good time to take a look at beta 1 of Visual Studio.NET 2005