Jump to content
  • Advertisement
Sign in to follow this  
beebs1

Exceptions

This topic is 3914 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya, I'm using C++ exceptions in my current project, which consists of several DLLs. I read a few days ago that it's best not to let exceptions pass from the DLL to the EXE, as doing so can cause problems if different compilers were used for each. Is this correct? Thanks for any help [smile]

Share this post


Link to post
Share on other sites
Advertisement
Different compiler's exception handling can be radically different. MSVC uses structured exception handling (SEH) as the underlying mechanism for its C++ exception implementation. GCC, on the other hand, uses setjmp/longjmp (SJLJ) to implement C++ exceptions on Win32. These two mechanisms share more or less nothing in common. Trying to catch a SEH exception with SJLJ won't work and vice versa; more importantly, stack unwind won't be detected from one to the other, so if you have a function compiled with MSVC called from a function compiled with GCC called from a function compiled with MSVC, and the first function throws, you may catch the exception, but leak the resources the GCC function allocated. This is not a good thing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!