From: William S F. <ws...@fu...> - 2010-12-05 19:15:16
|
Bob Smithson wrote: > I am using Swig 1.3 (to wrap C++ to Python). Although I have > successfully used the %exception > directive in the 'targeted' form: > > %exception C::f { > ... > } > > I have never got it to work with the 'catch-all' form: > > %exception { > ... > } > > There is no difference in the code I am placing in the two versions. > > My understanding is that any classes in the .i file that follow the > second form of the directive should have all their member functions in > the *_wrap.cc file modified to include the specified exception > handling code. However, the directive seems to get ignored. There > are no warnings from running Swig, but the exception handling code > does not get added to the wrapper code as in the other case. > > Although I could specify the directive for each function individually, some of > the interfaces are large so this would dominate the .i file and be a > maintenance headache. > > Is there some magic I am missing or is this a known problem? > The global %exception feature should work. %exception is just a feature (called "except") and perhaps you have some other feature taking precedence? Read about features here where it has references to the matching rules used: http://www.swig.org/Doc2.0/Customization.html and the matching rules William |