[C++-sig] Inserting custom code into pyplusplus output

Niall Douglas s_sourceforge at nedprod.com
Wed Jun 14 23:24:48 CEST 2006


On 13 Jun 2006 at 21:13, Roman Yakovenko wrote:

> > > mb = module_builder_t( ... _
> > > FXApp = mb.class_( 'FXApp' )
> > > FXApp.member_functions( 'init' ).exclude()
> > > init = """def("init", &FX::FXApp::init,
> > > &TnFOX::FX_FXApp_Wrapper::default_init_3)"""
> > > FXApp.add_code( init )
> > > ...
> >
> > Unfortunately, FXApp::init is a required function for all GUI
> > programs. It also mandatorily takes argc and argv.
> 
> I think I was not clear. I showed you the way to replace code that would
> be generated by pyplusplus for FXApp::init member function, with your own code.

Ah right. I did get that bit, but I didn't see how to custom insert 
some text before the RegisterFXApp() function. For example, if using 
the above trying:

FXApp.parent.adopt_creator(code_creators.custom_text_t(<FXApp::init 
replacement definition>))

... it turns out FXApp.parent is a namespace, and it wouldn't let me 
adopt custom code into it.

Once again, consulting the source left me pretty clueless :(

Cheers,
Niall






More information about the Cplusplus-sig mailing list