none
How to make a compiler link with __CxxFrameHandler instead of __CxxFrameHandler3

    Question

  • How to make a compiler link with __CxxFrameHandler instead of __CxxFrameHandler3. Is there is any option available.

    We are developing printer drivers for Vista Operating system, for the XPS print path, using PT/PC support.

    Problem:

    Though we could install the binaries on the Vista OS, we were not able to
    install the Vista binary set on a XP operating system. 

    We have installed the .Net3.0 on XP Operating system.

    Issue:

    On investigation, we found that one of our DLL was referring to some
    functions like :
    *       strcat_s,
    *       _itow_s,
    *       __CxxFrameHandler3,
    *       _except_handler4_common

    The issue is that the above functions "are not" exported by MSVCRT.DLL
    available on XP SP2 OS.

    Build Setup:

    We are currently building the dll from the Vista build environment available
    with 5600 WDK. Using XP build environment is not possible, due to build
    errors.

    Wednesday, November 15, 2006 3:04 PM

Answers

  • Msvcrt.dll was a CRT library for several versions of the C++ compiler ago.  VS6 I'd guess.  You can't use it anymore for a modern (VS8) C++ compiler.  You could make your printer driver dependent on the new CRT DLL libraries.  Probably not a good idea, just link to the static CRT libraries so you won't have to bother deploying the DLL version.  Project + properties, C/C++, Code generation, Runtime Library = /MTd for the debug configuraton, /MT for the release configuration.
    Thursday, November 16, 2006 12:19 AM

All replies

  • Msvcrt.dll was a CRT library for several versions of the C++ compiler ago.  VS6 I'd guess.  You can't use it anymore for a modern (VS8) C++ compiler.  You could make your printer driver dependent on the new CRT DLL libraries.  Probably not a good idea, just link to the static CRT libraries so you won't have to bother deploying the DLL version.  Project + properties, C/C++, Code generation, Runtime Library = /MTd for the debug configuraton, /MT for the release configuration.
    Thursday, November 16, 2006 12:19 AM
  • Thank you very much for heeding to me.
     
    Using Static linking leads to issues like,
     
    1. Higher memory foot print.
    2. Heap issues across dll boundaries, allocating memory in the Heap in one DLL passing the Pointer to another DLL and trying to free it.
    3. Other disadvantages of static linking.
     
    I will be delighted if there is any other way arround.
     
    regards,
    Karthikeyan.
    Thursday, November 16, 2006 12:40 PM
  • Well, sure, but does this really matter for a printer driver?  Check this article on how to deploy the VS8 CRT library DLLs.  You could probably still rely on Msvcrt.dll by disabling exceptions (omit /EH) and by avoiding the security enhanced CRT functions such as strcpy_s().
    Thursday, November 16, 2006 1:48 PM
  • Thanks for your suggestion, Using Static linking my problem got solved, but I want to have dynamic linking.

    The pointer you have provided talks about installing dlls on a target machine. But my story has a twist, the dll which I am building links to "MSVCRT.DLL" of Vista and not MSVC80, when the same DLL is being used on an XP machine: some of the imports( please refer to above) are not resolved with the MSVCRT.DLL available on XP.

    __CxxFrameHandler3 is not exported by MSVCRT.dll available on XP, but it exports __CxxFrameHandler, if I could some how avoid linking to __CxxFrameHandler3 then my dll will have no problems. This is solution which I am looking for.

    Another alternative could be, Microsoft can provide an upgrade for the XP operating system, as a part of the .net3.0 instalation.

    regards,

    Karthikeyan

    Monday, November 20, 2006 4:22 AM
  • Are you using the Windows Vista SDK? You cannot use the Vista SDK to compile/link unmanaged code for non-Vista platforms. A quick fix would be to have a post-build executable that changes the import table in your library (rename __CxxFrameHandler3 -> _CxxFrameHandler2 or 1 or nothing)
    Thursday, December 28, 2006 7:06 PM
  • Hello Rafael.

    You mentioned that you cannot use the Vista SDK to compile/link unmanaged code for non-Vista Platforms.

    Is this true even if the code is statically linked ?

    I have an unmanaged C++ code compiled using Vista SDK.  I would like to have this application run on both Vista as well as XP.   Will it be possible if it is statically linked ?

    Thanks

    Debendra

    Tuesday, February 27, 2007 9:06 AM
  • Sadly, yes it is true for statically linked code too. The entire SDK is useless for unmanaged development and will require you fall back to a previous SDK.
    Tuesday, February 27, 2007 12:45 PM
  • Sorry to intrude , but I really hope previous post is just a mistake. I did not explore Vista SDK yet, but from documentation I see that (http://www.microsoft.com/downloads/details.aspx?familyid=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en#Overview)

    1 . "...The Windows SDK for Vista also supports creating applications for Windows XP, Windows Server® 2003 SP1, and Windows Server 2003 R2. ..."

    2. " ... Windows SDK includes more than 100 GUI and command-line tools to aid in the development of native (Win32) and managed (.NET) systems ..."

    Does anybody have direct experience with it?

     

     

    Tuesday, February 27, 2007 1:55 PM
  •  aao123 wrote:

    Sorry to intrude , but I really hope previous post is just a mistake. I did not explore Vista SDK yet, but from documentation I see that (http://www.microsoft.com/downloads/details.aspx?familyid=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en#Overview)

    1 . "...The Windows SDK for Vista also supports creating applications for Windows XP, Windows Server® 2003 SP1, and Windows Server 2003 R2. ..."

    2. " ... Windows SDK includes more than 100 GUI and command-line tools to aid in the development of native (Win32) and managed (.NET) systems ..."

    Does anybody have direct experience with it?



    I created a separate thread explaining how that line is confusing. I downloaded it. I installed it. You cannot use it to develop Win32 unmanaged code for previous platforms, period. If you are developing unmanaged applications for earlier platforms, you need to remain on the Windows Server 2003 R2 SDK.
    Tuesday, February 27, 2007 10:40 PM
  • Thanks.

    In my application, I am branching out to different set of sdk functions depending on the OS version.  If the OS version is XP and before, a different set of functions get called.  If the OS is Vista, then I call the Vista specific sdk functions.  The functions are related to subscribing and reading event logs and there is no UI.

    I would like to distribute a single application for both the operating systems, even if it requires static linking, or changing the import table post build.

    Is this possible ?

    Thanks again.

    Wednesday, February 28, 2007 8:01 AM
  • Great.... Thank you for the information. Again sorry for the intrusion.

    Thursday, March 01, 2007 1:53 AM