2
votes

I want very specific answer from the developers who did this and want to know how you resolved the problems you faced.

We have very big MFC (VC6) 32 bit application existing for 10 years. Now we would like to migrate it to .NET unmanaged 64-bit application. Here we have some problems, our UI should not change, we may need some managed .NET class for easier development, without affecting architecture how to add managed code with unmanaged code, lots win32 APIs might get changed to new APIs, should be run in XP, Vista, Windows 7 OS machine without any change, these activities should not be time consuming, new technologies analysis should be done as we are MFC programmers...

Pls share your experience and if you have any clear documents will be very helpful...

Note: For the clear understanding, I am re-phrasing some points again. We want to migrate our VC6 native code 32-bit application to VS2008 (or VS2010) native code (unmanaged C++) with 64-bit support. The primary requirement is there should not be any change in existing UI. In Addition, if .NET supports the combination of managed code with unmanaged code, we can try using some features like .NET remoting in unmanaged C++ environment. And one more important thing I would like to convey to all is that we are not going to start any coding in C# or from scratch.

3
Do you want to rewrite your app in C# for .NET or do you just want to get your MFC app to compile in Visual Studio 2008 as a C++ application?auujay
You are asking for a very specific answer on a very unspecific question. No telling what you'll run into after avoiding this for 10 years.Hans Passant
@auujay: I think Snabak is referring to just getting hte MFC apps to compile in VS2008 and changes relevant to 64 bit support. Rewriting the app in C# is out of question since the entire KLOC will come to around 550 KLOC.ckv
It's either .NET or unmanaged. Which? Leaving it as native (unmanaged) C++, getting it to build in 2010 and taking advantage of the updated MFC is do-able. Migrating it to managed code is a whole different game.Kate Gregory
Friends... Thanks for your comments. For the clear understanding, I am re-phrasing some points again. We want to migrate our VC6 native code 32-bit application to VS2008 (or VS2010) native code (unmanaged C++) with 64-bit support. The primary requirement is there should not be any change in existing UI. In Addition, if .NET supports the combination of managed code with unmanaged code, we can try using some features like .NET remoting in unmanaged C++ environment. And one more important thing I would like to convey to all is that we are not going to start any coding in C# or from scratch.Snabak Vinod

3 Answers

4
votes

We've done this is steps (VC6 -> VS2005 -> VS2008 -> (soon) VS2010 ) and most issues were related to changes in the API.

  • unsafe string operations (strcpy vs. strcpy_s ) that give out a TON of warning messages (use the _CRT_SECURE_NO_WARNINGS preprocessor define to remove them if you do not want to fix them all )

  • Changed in prototypes for message handlers (returns LRESULT, changes in WPARAM and LPARAM, ... )

  • Deprecated API (you'll find them out soon enough, I think there's a page on msdn about that)

  • Compiler might be a bit more strict in regards to standard C++ .

It's hard to go to specifics...

but have a look at this blog entry for some more info : http://insidercoding.com/post/2008/08/20/Migrating-from-VC6-to-VC9.aspx

Good luck. Max.

2
votes

What you're asking for isn't really a migration -- it's a nearly complete rewrite, at least of the entire UI. Unless your "very big ... application" has a very small, simple UI, I'd sit back and think hard. Read Joel's Things You Should Never Do.

Bottom line: this is almost certainly a really bad idea. If you do it anyway, you need to start out aware that it will be quite time consuming.

If you decide to go ahead with this, you nearly need to do it incrementally. To do that, I'd probably start by finding discrete "pieces" of functionality in your existing code, and turning those pieces into ActiveX controls. Once you've gotten that to the point that your main program is basically a fairly minimal framework that most instantiates and uses ActiveX controls, it becomes fairly easy to create a new framework in managed code that does roughly the same thing, delegating most of the real work to the existing ActiveX controls. Once you've done that, you can start to migrate individual controls to managed code as you see fit.

The point of doing things this way is to avoid having a long interval during which you're just writing new code that duplicates the old code, but can't do any updates for your customers. Nearly the only reasonable alternative I've seen work reasonably well is to have two separate development teams: one continues to work on and update the old code base at the same time as the second team starts the total rewrite from the ground up. If you have enough money, that approach can work out quite well.

Microsoft, for one example, has done things like this a number of times. Just for a couple of examples, years ago when there were rumors that Borland (then Microsoft's biggest competitor in programming language tools) was going to produce a TurboBASIC, Microsoft decided QuickBASIC (V2 at the time) really couldn't compete. They responded by setting up two teams: one to do as much upgrading as reasonable to QuickBASIC 2 to produce QuickBASIC 3. The second team did a total rewrite from the ground up, producing what became QuickBASIC 4.

Another example is Windows 95/98/... vs. Windows NT. They continued development of the existing Windows code base at the same time as they did a total rewrite from the ground up to produce Windows NT. Though they kept the two teams synchronized so UIs looked similar and such, the two were developed almost entirely separately from each other. Only after years of overlap between the two did they finally quit working on the old code base (and I sometimes wonder whether the crappiness of Windows Me wasn't at least partly intentional, to more or less force users to migrate to the NT code base).

Unless you can do that, however, nearly your only chance of success is to use an incremental approach.

1
votes

As Jerry has mentioned Joel talks about this in his blog Things You Should Never Do. Moreover there are other things to be considered with this conversion.

  1. What would you do with existing VC++ 6.0 code base.
  2. Qualification time( different OS, SQL etc) needed to test the entire product after the changes are made.
  3. How do you manage 2 code bases with and without 64 bit support.

PS: Most importantly by the time you fix and qualify your product in VS2010 i guess VS 2012 would have released :)