Exception when using delayload linker option in release build

G

Guest

I have a VC++6 project where I need to delay load a DLL. I used a structured
exception handling frame and all seems to work when I build the debug version
and run it (either in or out of the debugger). In debug build, the exception
is caught and reported gracefully to the user. When I build the release
version and run it, the SEH frame does not catch the exception and the
application crashes.

Has anyone had a similar experience and if so, what is the resolution?
 
W

William DePalo [MVP VC++]

HairlipDog58 said:
I have a VC++6 project where I need to delay load a DLL. I used a
structured
exception handling frame and all seems to work when I build the debug
version
and run it (either in or out of the debugger). In debug build, the
exception
is caught and reported gracefully to the user. When I build the release
version and run it, the SEH frame does not catch the exception and the
application crashes.

Has anyone had a similar experience and if so, what is the resolution?

This is a guess. Try rebuilding with the /EHa switch.

If it does not fix the problem, as Emily Litella used to say "nevermind".

If it does it is because the Release build optimizes away your exception
handling. That can happen when it doesn't see a way in which an exception
can be thrown. Realize that the compiler has limited information when it
does this - it does not know about structured exceptions, it only knows
about C++ exceptions.

Regards,
Will
 
D

Doug Harrison [MVP]

HairlipDog58 said:
I have a VC++6 project where I need to delay load a DLL. I used a structured
exception handling frame and all seems to work when I build the debug version
and run it (either in or out of the debugger). In debug build, the exception
is caught and reported gracefully to the user. When I build the release
version and run it, the SEH frame does not catch the exception and the
application crashes.

Has anyone had a similar experience and if so, what is the resolution?

Have you tried changing the exception-handling compiler option for the file
from /GX (implies /EHsc) to /EHa?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top