Archived

This forum has been archived. Please start a new discussion on GitHub.

Crash on startup with Visual C++ 2008 Express

My program is crashing during startup in generated code before main is called.

Dialog box says: "The application failed to initialize properly (0x80000003). Click OK to terminate the application"

This appears to be a bug in the compiler. The code is included below. It breaks at closing brace of the constructor when calls the destructor the temporary string that was passed to addExceptionFactory as the first arg.
class __F__xml__XmlParseException__Init
{
public:

    __F__xml__XmlParseException__Init()
    {
        ::IceInternal::factoryTable->addExceptionFactory("::xml::XmlParseException", ::xml::XmlParseException::ice_factory());
    } // <-- Crash here destroying tmp string!!

    ~__F__xml__XmlParseException__Init()
    {
        ::IceInternal::factoryTable->removeExceptionFactory("::xml::XmlParseException");
    }
};

static __F__xml__XmlParseException__Init __F__xml__XmlParseException__i;
Ice version 3.3.1

Compiler version: Visual C++ 2008 express edition.
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

Compiler command line args:-nologo -W3 -WX -GR -EHa -FD -D_CONSOLE -GL /RTCu /MP2 -GF -Gm -O2 -MD

Debug version: -nologo -W3 -WX -GR -EHa -FD -D_CONSOLE -GL /RTCu /MP2 -Zi -D_DEBUG -Od -MDd

Comments

  • bernard
    bernard Jupiter, FL
    Hi John,

    If it is a Visual Studio 2008 compiler bug, I am afraid there is not much we can do.

    Do you see the same problem with any of the C++ demos we provide?

    Did you try your code with Ice 3.4.0? (Note that the Ice 3.4.0 binary distribution for Windows was built with Visual Studio 2008 SP1, so you would need to apply SP1 to your installation).

    Best regards,
    Bernard
  • This was working before and is now not working. I think it stopped working after my PC auto installed some updates to SP1 because when I checked more closely it says that I have express SP1 but I'm not sure when it was installed. What is interesting is that it was working on my PC for a sometime now and other folks at my work would install the 2008 express but could not run the Ice application that I built even though it ran on my PC just fine. My current theory is that when they installed VC++ on their PCs it would pull down the SP1 patch at the same. I installed my copy a year ago so maybe I was running without SP1?

    As for Ice version 3.4.0 I have installed it on my PC but I'm not set up to run the slice2cpp compilers on the PC yet. My current build process runs them on Solaris 10 and then completes the build on my PC from the same NFS mounted directory. When I tried to upgrade on Sol10 it failed with a strange shared object error in slice2cpp. I will try running slice2cpp on the PC next.

    Your web site says you support 2008 express SP1 so I expect the samples will run so I will try that too.
    bernard wrote: »
    Hi John,

    If it is a Visual Studio 2008 compiler bug, I am afraid there is not much we can do.

    Do you see the same problem with any of the C++ demos we provide?

    Did you try your code with Ice 3.4.0? (Note that the Ice 3.4.0 binary distribution for Windows was built with Visual Studio 2008 SP1, so you would need to apply SP1 to your installation).

    Best regards,
    Bernard
  • Demo worked so now what?

    I tried the "value" demo and it worked. I picked this demo because the generated code has the same call to 'factoryTable->addExceptionFactory' that was failing for my code but the demo is working. So does this mean it may not be a bug in Visual C++ 2008 after all? I ran this with Ice 3.4.0 so I guess now I need to go back and run the demos in Ice 3.3.1. The generated code in this area looks exactly the same so I don't expect it to change at all. If it works I'm still at loss as to why my original code doesn't work.

    It may be because of a complex linking/loading issue which could still be a complier bug. I still think the C++ run time library was not initialized soon enough in my case. Things are unpredicitable in the time before main is called and the Ice generated code is expecting a lot of things to be working during this program start up period. Larger programs just may link differently.
  • I found the problem.

    I had a bug in the makefile and the manifest was not being embedded in the exe as part of the build step. It's strange the exe didn't refuse to run with a meaningful error message instead it just crashed.

    If the exe is run from the source dir and the manifest is available then it will find it and run just fine. But when it is deployed without it does not work at all. Deploying with the manifest will also work but I think that is not a good option if it can be folded into the exe.

    Thanks for your demos so I had something to compare my code and Makefiles with!