Re: Moving to MSVC++.Net



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.


.



Relevant Pages

  • Re: Visual C++ 6.0 & Visual C++ Toolkit 2003
    ... 2003 Toolkit compiler. ... Assuming Visual Studio 2003.NET uses the same C++ compiler as the free 2003 Toolkit is it possible to make Visual Studio 2003.NET point the include/lib folder path to Visual C++ 6.0 ones? ... As I recall, I used the VC6 MFC libs and the VS2003 C/C++ ones. ...
    (microsoft.public.vc.mfc)
  • Re: How can this odd warning be fixed?
    ... > But, I have Visual Studio 6, and need to get a feel for it, so when my ... using the std lib as much as possible in VC6. ... With the compiler truncating an identifier, ... (But there is indeed another warning hinting ...
    (microsoft.public.vc.language)
  • Re: #importing type libraries
    ... hardware platform as the interface to their system. ... However, they built the type library with Visual Studio 6, and I'm ... by VC6, ... Type library is a binary standard independent of compiler version. ...
    (microsoft.public.win32.programmer.ole)
  • Re: About C++ IDEs
    ... VC6 is more than an IDE and I didn't talk about the IDE. ... The compiler in VC6 is fine. ... What's wrong with C or even assembler? ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Compilation of Code in Microsoft Visual Studio .NET and a couple of other Microsoft .NET questio
    ... I've just recently installed the Visual Studio .net Professional ... part of visual studio, not the compiler. ... then does that mean that I have found a security flaw in .NET or is it just ... Visual Studio .NET will that executable require the .NET framework to be ...
    (microsoft.public.dotnet.general)