469,964 Members | 1,824 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 developers. It's quick & easy.

PROBLEM: compiling C programs that link to Python

Hi all.

I'm not subscribed to the list, so all replies to me mail directly.

I ran into a small problem, for which we have found a workaround. I was compiling PostgreSQL v7.4.1 and it's PL/Python module. Compilation failed on lines which had this:

typedef struct PLyPlanObject {
} PLyPlanObject;

The problem was in that semicolon following "PyObject_HEAD", since that is a CPP define which expands to this:

typedef struct PLyPlanObject {
int ob_refcnt ; struct _typeobject * ob_type ; ;
} PLyPlanObject;

That extra ";" breaks compiling on strict ANSI-C compilers (or at least on mine - DEC CC on Tru64 UNIX). The workaround was to remove the ";" from plpython.c source file. It could be that GNU C is not complaining on this, since it is more lenient on C irregularities.

The idea I'd like to float here is that you guys remove the trailing ";" from your "#define ...". The source looks much more natural with a semicolon at the end.

I know that this idea is going to create resistance, "it is working for us", "it is working on GCC", "it will create other changes in existing source base", "you've solved your problem". The only argument in my favour I can give is that, well, C standard doesn't recognize "; ;" in "structs". So, if you want to create CPP constructs like that "#define", create them so they can be used without breaking the standards.

Jul 18 '05 #1
0 1207

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by RJS | last post: by
3 posts views Thread by Zdenda | last post: by
2 posts views Thread by Dimi Shahbaz | last post: by
6 posts views Thread by Club-B42 | last post: by
5 posts views Thread by J | last post: by
11 posts views Thread by ZMY | last post: by
4 posts views Thread by vedrandekovic | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.