Python/C interface proposals

Albert Hofkamp hat at se-46.wpa.wtb.tue.nl
Wed May 3 10:11:58 EDT 2000


On Tue, 02 May 2000 03:10:06 GMT, Dave Abrahams <abrahams at mediaone.net> wrote:
>I propose some simple changes to the Python header files which would make it
>much easier to write "clean" wrappers in C++.
>
>The first change I propose would make it possible to forward-declare any
>struct in the Python headers. This could be done by changing declarations of
>the form:
>
>    typedef struct {...} Name;
>
>to:
>
>    typedef struct Name {....} Name;

I would split the two in 2 definitions:

struct Name { ...};
typedef struct Name Name;

My gcc compiler does not complain about the double use of the name, so
at least one compiler allows it.

Secondly, the latter definition may be surrounded by
#ifndef cplusplus
..
#endif
(or whatever the exact syntax for it may be), so it does not get
included when compiled by a C++ compiler (which performs the latter
definition by itself).


By the way, is Python moving towards ANSI standards ?
I'd like to compile Python with C++ (g++) but it hates the K&R style of
formal parameters.
I'd be willing to invest some time in this change.


Albert
---
Look ma, windows without Windows !!



More information about the Python-list mailing list