[C++-sig] Python API wrapping details

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jun 20 19:04:42 CEST 2002


--- David Abrahams <david.abrahams at rcn.com> wrote:
> > I'm proposing the following  techniques for wrapping the python API for
> BPL.
> >
> > Boost header files will be created from a python script. The script will
> > contain a list of all the supported API functions and their attributes,
> such
> > as whether borrowed or new references are returned, error handling, etc.
> All
> > the API metadata will be defined in the python script. The python script
> > will then use a set of rules to generate the API wrappers from this
> > metadata.
> 
> That sounds slower than just doing it by hand overall. The API isn't that
> big.

I am a big fan of the python script idea, having done similar things several
times myself. In my experience this approach always saves you more time than
you think. Keep in mind that you do not have to bend over backwards mentally to
generate code with Python (in comparison with certain alternative automatic
code generation techniques; no names mentioned; it is a pitty that the C++
compiler cannot call Python to generate code on demand). It is also much more
fun to keep the script up-to-date than highly redundant source code.

Recently I stumbled over something in the Python directory (unpacked tar
file)that looked like an approximation to the API metafile you have in mind.
Are you aware of this?

Ralf


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com





More information about the Cplusplus-sig mailing list