[C++-sig] Pyste-generated extentsion Aborts Python

Nicodemus nicodemus at globalite.com.br
Fri Jul 4 02:26:17 CEST 2003

Hi Jim!

Jim Wilson wrote:

> Nicodemus,
> I got the CVS, and it seemed to fix the "overloaded bar(char**)"
> problem I mentioned before.  My goal was to wrap (at least a portion
> of) the Fast Light ToolKit (FLTK: http://www.fltk.org ).  Others are
> attempting this with SWIG ( http://pyfltk.sourceforge.net/ ), but I
> was hoping Pyste would simplify the job.
> Alas, I'm not sure I can simplify the files I'm wrapping, but my wrapper
> is quite lightweight.  Since I didn't want to figure out all those 
> "needs-
> a-policy" complaints, I wrote a small header which exposed only the 
> routines
> I needed from FLTK Version 1.1.4.

This does not seems like a good idea... the policies are *really* 
needed. If you want to expose only a few functions, then you can always 
exclude() the ones that you don't want.

>   I'm not sure you want this, but here it is:
> fltk.h:
>     class Fl {    // A class masquerading as a namespace,
>       public:    //   Fl is essentially a buch of static methods
>         static int run();
>     };
>     #include <.../Fl_Window.H>    // This will be instanciated
> fltk.pyste:
>     Class("Fl", "fltk.h")
>     w = Class("Fl_Window", "fltk.h")
>     exclude(w.icon)        # Easier to exclude than use the
>     exclude(w.child)    # trick I did with class Fl, since
>     exclude(w.current)    # I may want to *do* something with
>     exclude(w.array)    # my Fl_Window!
>     exclude(w.resizable)
>     exclude(w._ddfdesign_kludge)
> (In fltk.h, <...> was the path prefix my the directory holding 
> Fl_Window.h.)
> I pysted, beat bjam into submission, and got a clean compile and 
> link.  Now
> came python:
>     >>>from fltk import Fl, Fl_Window
>     >>>w = Fl_Window(0,0, 600,400)
>     >>>w.show()
>     >>>Fl.run()
>     Abort
> The "w = ..." line, creates a window in the upper left corner (0,0) of 
> size
> 600x400 pixels.  The next draws it on the screen, the last one fires 
> up the
> event loop.  The window is momentarily displayed before it immediately
> vanishes and "Abort" appears (followed by the bash prompt).

Hmm... could you post the code generated?

> The running python is half as big as the SWIG version though ;D.

Indeed? I always thought that SWIG would need less memory (not 
necessarily faster), since it is autogenerated C... congratulations to 
Boost.Python then. 8)


More information about the Cplusplus-sig mailing list