MS C++ exception


I will revise the question statement so that the problem is clearly stated. The application uses CORBA.

The server implemented as a Dll exports a class called the ContractServer. Within this class there are several methods. One of them is called IntiliazeContractServer(). This function basically reads some ini file and fills in a set of data structures. The same is done for all other servers implemented as Dlls.

Inside the main(), I initialize CORBA classes by calling CORBA::Innit and then create an instance of each of the servers and invoke the initialize method on them. If the Initialize was successful, I call the method obj_is_ready (CORBA specfic) and after all the servers have been initialized, I call impl_is_ready
(CORBA specific again).

When the pplication is run, it throws an exception
(0xE06D7363: First chance exception in MSVCRT.dll). It does not even reach the function main().
I hope the question is more clear now.


// old question
I am developing an application, which loads uses/initialises servers implemented as DLLs. When the calling exe starts an exception is thrown
(0xE06D7363: First chance exception in MSVCRT.dll). This exception arrives even before the execution has reached main(). I have checked all the compile options and they are correct. The application is being compiled with the
/MDd option and inclusion of other libraries has been disallowed using  
NODEFAULTLIB:libname. It will be a great help if I can a solution to this problem.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the application is blowing up before it ever calls the calling DLL then your problem is with what ever is calling the calling DLL.  You will nee to provide a better problem description for us to be able to help you out.
shayadAuthor Commented:
Edited text of question.
Ok, a shot in the dark.

The option -MD is required in order for you to use msvcrt.lib, which is required by ObjectStore.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

shayad, please don't edit the question once comments have been psoted, just post comments yourself.  Otherwise it makes it hard for experts to follow the question history.

If you app is creahing before main, the cause is either a problem in a DLL (as dhymes suggested) or in the constructor of a global object.  So you may want to look into the constructors of any class that you declare a global instance of.

You can step into the VC RTL to try to find out when and where it is crashing.  That may help you.  Instead of debugging by starting with f5, just press F9, step into, and step inthe first line of the RTL code, then debug the RTL code until you can find out where it is creashing and what sort of thing is going on there.
'First-chance exception in msvcrt.dll...' just means that a function from within the 'msvcrt.dll' caused an access-violation exception that was handled successfully inside the SEH frame that was active when the exception occurred. You can think of it being the same as if you use code like this:

long l;

__try // set up current SEH frame
CopyMemory ( &l, 0, sizeof ( long)); // read from 0x00000000
__except( EXCEPTION_EXECUTE_HANDLER) // handler for current frame
puts ( "We knew that this would go wrong...");

(Additional info: MS KB Article Q105675)

The article can be found at 

A first chance exception is called so as it is passed to a debugger before the application 'sees' it. This is done by sending a 'EXCEPTION_DEBUG_EVENT' to the debugger, which can now decide whether it is passed to the apllication to handle it or 'ignore' it (e.g. like an 'EXCEPTION_BREAKPOINT' aka 'int 3')

If the exception isn't handled, it becomes a '2nd chance' exception, the debugger 'sees' it the 2nd time and will usually terminate the program (without using a debugger, these exceptions end up at 'UnhandledExceptionFilter()' which will also signal the exception to the user with one of these 'nice' message boxes and terminate the program, also...)

BTW: 'first chance' exceptions are only displayed when running a debugger - you can safely ignore them...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
True, but he says "it does not even reach main", so I think there is a crash too.  i.e. the exception is getting handled, but something else is causing problems and causing a crash.
VObjectStore handles all access violations to determine if they are persistent memory accesses. If you handle access violations in the Visual C++ debugger you would disrupt this, so leave this
exception unhandled in the debugger. You might see multiple exception messages such as the following:

First-Chance Exception in  yourprog.exe: 0xC0000005: Access Violation.
First-Chance Exception in  yourprog.exe: ( something.DLL) 0xC0000005:
Access Violation.

You can safely ignore these messages.

Only one suggestion:
This could be an issue because Visibroker supports VC 5.0 and you're building with VC 6.0.
But a better thing would be to get a version of Visibroker which supported VC 6.0.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.