How to register an exception translation?
Fatal error C1204:Compiler limit: internal structure overflow
Generated file name is too long
struct window_t{
...
void get_size( int& height, int& widht ) const;
};
You can not expose get_size function as is - int is immutable type in Python. So, we need to create a wrapper to the function:
boost::python::tuple get_size_wrapper( const window_t& win ){
int height(0), width( 0 );
win.get_size( height, widht );
return boost::python::make_tuple( height, width );
}
class_<window_t>( ... )
.def( "get_size", &get_size_wrapper )
...
;
Now, after you know how this problem is solved. I will show how this solution could be integrated with Py++.
wrapper_code = \
"""
static boost::python::tuple get_size( const window_t& win ){
int height(0), width( 0 );
win.get_size( height, width );
return boost::python::make_tuple( height, width );
}
"""
registration_code = 'def( "get_size", &%s::get_size )' % window.wrapper_alias
mb = module_builder_t( ... )
window = mb.class_( "window_t" )
window.member_function( "get_size" ).exclude()
window.add_wrapper_code( wrapper_code )
window.registration_code( registration_code )
That's all.