Francois Gouget wrote:
__TRY {}/__FINALLY()? I'm not sure the changes I did are now compilable under MSVC nor MingW.
- Would there be a way to transform __try {}/__finally{} blocks to
Unfortunately they don't work exactly the same. There has been many attempts to improve exception support in Winelib but none that were deemed good enough to be committed to CVS.
Below is a technique I use in C++. I'm not sure it can be used in C. But if you have C++ it is perfect. And nothing needs done in Winemaker Just have the #define available before the using code like in your StdAfx.h file.
<__try__finally> #define __try try #define _CONCAT_(s1,s2) s1##s2 #define __except( foofoo ) \ catch(...){ \ int d = foofoo ; \ switch(d){ \ case 0: \ throw ; \ case -1: \ case 1 : \ goto _CONCAT_(gifs,__LINE__) ; } } _CONCAT_(gifs,__LINE__) : </__try__finally>
the CONCAT macro is because of the pseudo 2 pass of the preprocessor, Other wise the __LINE__ is not expanded to produce a unique goto label. goto is used to jump over the "}}" closing scope of the catch and switch. So using code does not change. (There is one restriction you can't use 2 __except statements in the same line)
Free Life Boaz