Re: Moving to MSVC++.Net
- From: "Alan Klietz" <alank@xxxxxxxxxxxxxxxx>
- Date: Mon, 6 Jun 2005 16:33:40 -0500
In evYPCIfaFHA.3712@xxxxxxxxxxxxxxxxxxxx, phil
<phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> thanks for all the info - much appreciated
>
> Phil
>
>
> "Alan Klietz" <alank@xxxxxxxxxxxxxxxx> wrote in message
> news:%232bgMMSZFHA.3152@xxxxxxxxxxxxxxxxxxxxxxx
>> In VA.00000b93.32cceba4@xxxxxxxxxxxxxxxx, Daniel James
>> <wastebasket@xxxxxxxxxxxxxxxx> wrote:
>>
>>> In article news:<OcwsVRHZFHA.1384@xxxxxxxxxxxxxxxxxxxx>, Phil wrote:
>>>> I have a perfectly good application in VC++ 6.0 and I dont want
>>>> to convert it to the .Net environment but (and sorry if this is
>>>> a naive question) can I continue to use standard MFC C++
>>>> programming but use the Visual Studio.Net environment.
>>>
>>> Yes, you can.
>>>
>>
>> Agreed. You can use the Visual Studio .NET IDE and VC7 compiler with the
>> original MFC libraries (MFC42.DLL). Just point VS.NET at the INCLUDE and
>> LIB folders from VC6. It requires tweaking a few VC6 MFC headers to make
>> them C++ standards compilant, such as adding the new keyword "typename"
>> to template declarations in AFXTEMPL.H and friends.
>>
>> To get the benefit of /RTC1 or /GZ runtime checking, link with the VC7
>> version of RunTmChk.lib. Call _RTC_Initialize() and _RTC_Terminate. (Use
>> lib.exe to remove the duplicate symbol __except_handler3 that
>> clashes with msvcrt.dll.) You also need the VC7 version of delayimp.lib.
>>
>> To get the benefit of VC7 stack overrun and buffer-overflow detection,
>> add a stub for __security_check_cookie.
>>
>> With these changes you can write MFC apps using Visual Studio.NET that
>> link with the built-in MFC42.DLL. You do not need to ship the bulky
>> MFC71xx.DLLs.
An easier way to get Visual Studio 2003 and 2005 C/C++ compilers to build
legacy applications is to include the C/C++ header files from Windows Server
2003 SP1 Platdorm SDK. These were quietly rewritten by Microsoft to allow
64-bit recompilation of legacy 32-bit code. But as a side effect they
effectively extend the life of VC6 for all platforms. This is because the
PSDK bundles the VS 2005 compiler (version 14.0) to build VC6 compatible
apps for 64-bit.
You won't be able to use the 64-bit compiler bundled with the PSDK on your
32-bit apps. But you can use Visual Studio 2005's 32-bit compiler with the
new PSDK. Just point Visual Studio IDE's INCLUDE folders at the PSSDK
folders: include\mfc, include\atl, and include\crt. Point the LIB folder
to your original VC6 installation. Now you can compile with Visual Studio
2005 and link correctly with MFC42.LIB and MSVCRT.LIB while enjoying all the
new IDE goodies and security checking. (You still need the VS 2005 version
of RunTmChk.lib and sehprolg.obj, and write the __security_check_cookie
stub.)
Using the old libraries is especially handy when building lightweight ATL
ActiveX controls that download with minimal size. Visual Studio 2005
normally requires you bundle several megabytes of DLLs with your application
(MFC80.DLL, MSVCR80.dll, MSVCP80.DLL, etc). In contrast
MFC42.DLL/MSVCRT.DLL version 6 have been ubiquitious and stable since at
least Windows 2000 SP2 and Windows 98 SE.
This way you can enjoy the benefits of the newer compiler technology while
keeping your application small. I recompiled over 100000 lines of legacy
MFC code from VC6 and it worked flawlessly. In fact the new optimizer with
/W4 caught several latent bugs that were lurking in the code previously.
Regards,
Alan Klietz
Algin Technology LLC
alank-at-algintech-NOSPAM-dot-com
P.S. Note: the C++ STL headers still need manual fixes. See
http://www.dinkumware.com/vc_fixes.html. You will need to merge in the
Dinkumware fixes into new STL include files by hand. Exception: The PSSDK
include file for <DEQUE> is radically different and should be used in lieu
of the Dinkumware fix.
.
- References:
- Re: Moving to MSVC++.Net
- From: phil
- Re: Moving to MSVC++.Net
- Prev by Date: Keeping Window Location
- Next by Date: Timer
- Previous by thread: Re: Moving to MSVC++.Net
- Next by thread: Restoring MDI child from minimized state
- Index(es):
Relevant Pages
|