Sign in to follow this  

C++/CLI and its place in game development.

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm learning C++/CLI at the moment and I'm trying to figure out what practical uses that it could have in developing a game. I imagine it can have the same functionality as C# which can be used to write tools or interfaces for a game. But does anyone here use C++/CLI in their games and how do you use it? Thanks

Share this post


Link to post
Share on other sites
Personally I only use it as a small interface when C# needs to use old Win32 functions and structures that are a pain to DllImport and recreate structs in C#.

I feel that the C++/CLI language itself is too cumbersome to use on a full-time basis for an entire project of any kind. It's got all of the old C++ downfalls and tons of special rules about interoping with native C and C++ constructs.

Share this post


Link to post
Share on other sites
C++/CLI really isn't made to design full, new, feature filled applications with. The entire thing is very messy, and you end up coding around all sorts of little issues. What C++/CLI is made for, and which it excels at, is creating glue libraries between managed and unmanaged code. By being to work with both natively, you can make wrappers much faster.

That being said, you should probably avoid it until you really need it. I would recommend focusing your attention on C#, which will be much more rewarding. In fact, I think it would be extremely difficult to learn C++/CLI without a thorough knowledge of both C++ and C#, so it really isn't an option for beginners.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
C++/CLI really isn't made to design full, new, feature filled applications with. The entire thing is very messy, and you end up coding around all sorts of little issues. What C++/CLI is made for, and which it excels at, is creating glue libraries between managed and unmanaged code. By being to work with both natively, you can make wrappers much faster.


Actually if you look at Stan Lippman's Blog at MSDN, or Herb Sutter's many comments on C++/CLI (especially his C++/CLI Rationale, you'll see that C++/CLI was designed for C++ programmers to be able to write C++ for .NET applications, instead of C# or whatever other language. Or as Sutter put it "Enable C++ to be a first-class language for CLI programming." I personally believed they failed at achieving this goal, but it wasn't designed just for making glue code.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Quote:
Original post by Mike.Popoloski
C++/CLI really isn't made to design full, new, feature filled applications with. The entire thing is very messy, and you end up coding around all sorts of little issues. What C++/CLI is made for, and which it excels at, is creating glue libraries between managed and unmanaged code. By being to work with both natively, you can make wrappers much faster.


Actually if you look at Stan Lippman's Blog at MSDN, or Herb Sutter's many comments on C++/CLI (especially his C++/CLI Rationale, you'll see that C++/CLI was designed for C++ programmers to be able to write C++ for .NET applications, instead of C# or whatever other language. Or as Sutter put it "Enable C++ to be a first-class language for CLI programming." I personally believed they failed at achieving this goal, but it wasn't designed just for making glue code.


OK, fair enough. I never read up on its background, but I can tell you that it really doesn't appear to be designed for anything else but glue code.

Share this post


Link to post
Share on other sites
I have a fair bit of experience with c++/clr, and I agree. Use it if you want to create a managed wrapper around an unmanaged library, or if you have a piece of code that absolutely HAS to be native. It's absolutely superb for both those needs.

But to write an entire program with it? No thanks. As Nypyren put it, it has all the pitfalls of c++, with a ton of extra features hacked on to allow it to use the CLR. It's very awkward and ugly, though not nearly as bad as managed c++ was.

Share this post


Link to post
Share on other sites
Quote:
Original post by gharen2
I have a fair bit of experience with c++/clr, and I agree. Use it if you want to create a managed wrapper around an unmanaged library, or if you have a piece of code that absolutely HAS to be native. It's absolutely superb for both those needs.

But to write an entire program with it? No thanks. As Nypyren put it, it has all the pitfalls of c++, with a ton of extra features hacked on to allow it to use the CLR. It's very awkward and ugly, though not nearly as bad as managed c++ was.

I agree the first time I saw examples of it I thought ugly and it was supposed to have been cleaned up and improved with new versions of Visual Studio but still reminds me of Pascal with it's use of ^ symbol everywhere!
Actually the old MC++ CLR language was so bad it's soon to be obsolete!

The old framework is no longer supported by Microsoft but you can get things to compile via the “/clr:oldSyntax” compiler option. Under the current framework all keywords have changed, destructors and finalizers work differently, and a slew of other things have been modified (for details see: Managed Extensions for C++ Syntax Upgrade Checklist).

Oh and to respond to the OP the only place I've seen it used extensively is quake2/3 .net ports.

Share this post


Link to post
Share on other sites

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this