[C++-sig] Way to insert code in _main.cpp in pyste
Nicodemus
nicodemus at globalite.com.br
Tue Sep 23 01:45:56 CEST 2003
Niall Douglas wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On 20 Sep 2003 at 22:45, Nicodemus wrote:
>
>
>
>>Must it be after BOOST_PYTHON_MODULE? If not, you can use the function
>>declaration_code(<code>) in your Pyste file. To insert code inside
>>BOOST_PYTHON_MODULE, use module_code().
>>
>>
>
>Kinda like this:
>
>// Exports
>====================================================================void RegisterConvFXString();
>void RegisterExceptionTrans();
>void Export_TnFOX_Python_FXFile();
>
>// Module
>=====================================================================BOOST_PYTHON_MODULE(TnFOX)
>{
> RegisterConvFXString();
> RegisterExceptionTrans();
> Export_TnFOX_Python_FXFile();
>}
>
>
declaration_code('void Export_TnFOX_Python_FXFile();\n')
module_code(' Export_TnFOX_Python_FXFile();\n')
But I see you want it inside _main.cpp... there's currently no way to do
that explicitly, but you can put it inside any other Pyste file and the
effect will be the same, since inside BOOST_PYTHON_MODULE your
Export_MyPysteFile() will called, which will then call your
ExportExceptionTrans(), for example. Try that and see if it works.
>BTW those two commands you suggest don't appear to have any docs.
>
They don't, that's why I posted an example.
I plan to update the documentation by the end of the week.
Thanks,
Nicodemus.
More information about the Cplusplus-sig
mailing list