Sign in to follow this  

issues with managed C++

This topic is 4593 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 just made the switch the vc .net 2003. When i created a new project and added some old code, things ran fine in debug mode but caused a runtime error in release. The key difference causing this was the "use managed extensions" option being ON in release mode. I switched it off and things ran fine. I do not know what managed C++ is and how it differs from unmanaged. The terms are new to me so I have some questions. 1) What is managed/unmanaged code and when are they each used? 2) Does leaving this option off have any effect on the final executable as far as size, memory usage, speed, etc.? 3) What could have caused my error. Based on my log, it appeard to crash on a function call as there were no operations between the last logged point and the next point that should have been logged. (Since this was debugging in release i just output to a file every other line to see where it crashed). I've found a few articles related to this but they only talk about how to handle both in the same project and whatnot, so i just need some quick direction and I'll be on my way. Thanks.

Share this post


Link to post
Share on other sites
Managed code is code that is, well, managed by the .NET framework. All memory allocations and deallocations are managed by the .NET framework, so you wouldn't have to delete memory. From what I've heard, managed C++ is really messy. C#, VB .NET, and all other .NET languages though are inherently managed. Microsoft tried to incorporate C++ into the framework as well by giving it the option to by managed.

Share this post


Link to post
Share on other sites
Makes sense. so anything i've written before .net is handled as unmanaged, and won't be integrable into other projects with other managed languages?

That seems to me like it adds some run-time overhead... or is the "managed" aspect applied at compile-time and you just have a safer app?

Still confused. thanks tho

Share this post


Link to post
Share on other sites
MSVC++ .NET 2003 will compile both managed and unmanaged C++ code. It sounds like you want to just compile unmanaged ("normal") code.

Basically - when you create your project, the name of the project type should have "win32" at the front, as opposed to "(.NET)" at the end.


The idea behind managed C++ is so existing programs and skills will transfer over to .NET eaiser and can be integrated into a managed (.NET framework based) project.

If you're not using .NET features, then don't make a managed project in the first place. If you're using C++, avoid needing .NET features at all.

If you want to use .NET for some reason and you have no existing C++ code, use C#. Of course, you'll also need (or be willing to get) the C# compiler and knowledge of C#.


It actually sounds to me as if you've successfully made an unmanaged project, and that something other than the managed/unmanaged thing is causing your error.

Are you using DLLs that do not have matching runtime library settings, perhaps?

What DLLs are involved? What code is crashing? Can you break it in the debugger? Can you confirm if it is a managed project or not?

Share this post


Link to post
Share on other sites
well when I turned off the "used managed extensions" project option it stopped crashing. Before this, I had located the error with the debugger. It was on a function call not related to any of the dll's. But I am using opengl32, openal, and winmm. I've worked with them in other projects so they have nothing to do with it.

The error does occur in your basic global function being called by another global if that matters.

It claims to be a win32 project and the only thing I found that has the word managed in it is that "use managed extensions" option. I'm just going to leave it off because I seem to have been doing fine without it.

Share this post


Link to post
Share on other sites

This topic is 4593 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