[C++-sig] pyplusplus tutorials & GUI wizard
roman.yakovenko at gmail.com
Tue Jan 31 06:32:38 CET 2006
On 1/30/06, Matthias Baas <baas at ira.uka.de> wrote:
> Roman Yakovenko wrote:
> >> I extended my test and already added more than one class and tried the
> >> write_multiple_files() function. Basically, it works fine, but one
> >> problem still remains: The output files will only compile if I include
> >> some additional header files (which actually depend on the class I'm
> >> wrapping). So how do I tell pyplusplus to add those headers to the
> >> output files? (in Pyste I was using the declaration_code() function)
> > Every code block that is written in file, is created by some code creator.
> > There are 2 relevant code creators:
> > 1. include_t
> > 2. precompiled_header_t
> > __init__ method takes file path/name to be included.
> > module_t class has method adopt_include. As argument it takes
> > include_t instance.
I think my previous answer was not complete. pyplusplus has 2 custom
custom_t and custom_text_t. If you need to write some text, any text,
can create instances of those code creators and put them in a right
place within extension
module code creators tree.
> ok, for every header I have a line:
> extmodule.adopt_include( code_creators.include_t("myheader.h") )
> The module compiles now. However, the above include files are inserted
> into every generated *.cpp file. I don't know if this will ever be a
> problem or not, but while I'm at it, how could I be more specific and
> add headers (or other code) to only some selected output files?
Right now there is no easy way to do it. I don't understand why it could be
a problem in future. I am sure I miss something.
This method works fine for boost.date_time and TnFOX.
Any way, when you need it, you need it. There is a way to do what you want.
file_writers package contains class multiple_files_t. This class is responsible
for writing\splitting extension module to multiple files. If you need
control you can always derive from this class and implement your
Please, check whether you work with latest CVS version or not. Few
days ago TnFOX
has problem that main function was too big. This class has been improved a lot.
It better splits extension modules to files and has mush clear implementation.
> Anyway, I'll continue my test and move on to the more complex classes
> that needed some manual intervention using Pyste....
Thanks for trying. I hope you will publish your experience and may be
I could learn a lot from seeing how you use pyplusplus
> - Matthias -
More information about the Cplusplus-sig