Winemaker questions

Boaz Harrosh boaz at
Mon Feb 21 02:16:41 CST 2005

Francois Gouget wrote:

>> __TRY {}/__FINALLY()? I'm not sure the changes I did are now compilable
>> under MSVC nor MingW.
> 4) 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 

#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__) :

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

More information about the wine-devel mailing list