[C++-sig] Inline error checking

Jeff Winkelman winkatl1213 at yahoo.com
Fri Sep 14 15:21:55 CEST 2007


I'm wrapping a large C++ library using boost and py++.  The C++ library does not use exceptions.  Instead, it uses a more C style of error checking where you need to call a set of error APIs after each call to check to see if an error occurred.

Using SWIG, you can add error checking code to each wrapped function or method by using the %exception directive.  This instructs the code generator to add the same error checking routine to each wrapper.

Does anyone know of a similar way to do this with boost or py++?

I've found where I can add a custom exception translator.  However, this doesn't really apply since this library doesn't generate exceptions.  I've also found where I can add custom code for a specific function.   This isn't ideal either due to the fact that the library is very large.

Is there a way to do this on a more "global" basis?  The error checking code is identical every time you call it.

Any sugessions are greatly appreciated.  Thanks in advance,


Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070914/2f076be7/attachment.htm>

More information about the Cplusplus-sig mailing list