views:

61

answers:

2

I come from a .NET background and will be going into the field of rendering / graphics using OpenGL/DirectX. For this purpose C++ will be my language of choice to interact with these rendering frameworks.

As I understand it Visual C++ allows native support for CLI which is an extension to C++ that allows the application to benefit from the managed runtime. Would you recommend spending time getting accustomed with C++/CLI or should I stick to plain C++?

Also, when using the Visual C++ IDE what can I expect from the compiler? Will standard C++ compiled code be standard executables capable of running anywhere that a normal C++ executable would run? I've heard that the compiler for VC++ comes with issues of its own.

+2  A: 

It really depends on what you're looking for. C++/CLI has advantages that few of the other .NET languages share (strong support for mixed mode being one of them), but it's still a .NET paradigm at heart. The only reason you're going to delve into it is if you want what .NET offers. If your primary need is for full-screen type applications, it's unlikely that learning the .NET extensions will get you much that learning one of the more capable C++ extension libraries wouldn't get you, and the C++-only option would retain cross-platform compatibility.

As to the compiler, recent years have seen dramatic improvements in Visual Studio's C++ compilation. The compiled executables require the correct runtime to be installed on the target system, but that is not a particularly onerous requirement.

Mike Burton
Also, you can easily add `/MT` (`/MTd` for debug mode) to statically link the runtime and get rid of that requirement.
Thomas
@Thomas: Not if you're using C++/CLI, which can only use the shared library version of the runtime.
Ben Voigt
That bit was only about native C++. C++/CLI does not just require the CRT, but the entire .NET platform (which also installs the CRT, by the way, but I'm not sure if this can be relied upon).
Thomas
A: 
  1. C++/CLI in general is a pain and imho, not worth the positives of having access to the .NET library.
  2. Visual C++ is a pretty decent compiler and will generate standard executables. However, it does follow the standard Windows paradigm of preferring to link to libraries dynamically and you may have issues if the correct libraries are installed on the running system. This could be an issue, say, for the standard c runtime, and some applications ensure that it is installed along with their program. If you dig into the build options, you can configure Visual C++ to do whatever you want, say link the c runtime statically (http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx)
Sanketh I
It's not about having access to .NET from C++/CLI, it's about having a much cleaner interface to the components built in C++/CLI than would be possible using p/invoke.
Ben Voigt