From: Rob M. <rob...@vi...> - 2006-12-19 22:11:42
|
Hello, I am using SWIG with a fairly large C API that uses return codes on many functions the general structure is like this: typedef int api_result; const api_result success = 0; const api_result error_type_1 = {some value}; const api_result error_type_2 = {some other value}; api_result foo1(int bar); api_result foo2(double baz); ... and so on. I would like this to turn into something like this post-SWIG: void foo1_wrapper(int bar) { api_result result = foo1(bar); if(result) { throw_appropriate_exception(result); } } So I want to get rid of those return codes in the SWIG-generated interface and instead use them in the wrapper functions to generate exceptions. I can see how to do the latter part (generating exceptions from the return code), but is there any way to nuke the return codes from the SWIG interface? Obviously I could write a custom wrapper for each function that doesn't return the code, but that's way too much work. Thanks, Rob |