If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] Mixed mode future, enumerations, static variables

Hello MVP's,

Question 1)
Does Microsoft plan to continue support for a mixture of managed and unmanaged c++ code in a single c++ project? If so, how long do they plan on supporting this option?

Question 2)
When projects are a mixture of unmanaged code written in c++ and then wrapped with managed c++ so a .NET GUI can be used, any enumerations defined in the unmanaged area are necessary in the managed area. So they need to be duplicated in the managed wrapper. Is there a simple way to do this without the error prone cut and paste from the unmanaged layer to the managed layer. It's not a big deal for a single enumeration, but this is a hassle for large software systems that contain enumerations at both the unmanaged and managed levels, and of course that is what I'm working on

Question 3)
In Visual Studio 2003 I have had problems with global static const doubles.

After stopping at a break point, the value of the variable period is 0.0 when is should be ~0.03333. What is going on here? The scenario is a c# GUI communicating with a mixed mode C++ DLL. The breakpoint is set in the managed dll and the static const double variable is defined in the managed DLL. The managed dll is made up of a managed c++ project and a static c++ library project that is linked in. When a simple unmanaged c++ client is written to link with just the static c++ library from the managed DLL, period appears as 0.0333333 instead of 0.0. This only appears to be a problem when the fully managed DLL is built and used by a managed client.

Re: Mixed mode future, enumerations, static variables

1) We support mixing managed and native C++ in a single project (heck, we support the mix in a single file!) today in Visual C++ 2005 with the "/clr" compiler option, and we plan to continue supporting this functionality as far into the future as we can predict today.

2) Enumerations are very different in the managed world (where they are syntactically more like classes) than the standard C++ world (where they are syntactically more like constants). I don't know of an automatic way to handle the conversion between the two, although I could think of some ways to prevent human error in manually writing wrappers... for example, you could declare all of your enums in standard C++ first and then write a perl script or small C++ program that automatically generates managed code versions as well as conversion functions for you.

3) I'm unclear as to whether you're talking about a debugger problem or a floating point calculation problem here. Are you saying the program works at run time but the debugger value is not correct, or is it not correct at runtime also?

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.