[capi-sig] python and fpos_t
Adam Olsen
rhamph at gmail.com
Thu Oct 9 10:52:58 CEST 2008
On Thu, Oct 9, 2008 at 2:25 AM, Dorian Krause <doriankrause at web.de> wrote:
> Hello everybody,
>
> I stumbled about a curious problem: Including <Python.h> changes the size of fpos_t.
>
> m01% cat fpos_python.cc
> #ifdef HAVE_PYTHON_H
> #include <Python.h>
> #endif /* HAVE_PYTHON_H */
> #include <stdio.h>
> int main(int argc, char** argv)
> {
> printf("sizeof(fpos_t) = %d\n",sizeof(fpos_t));
> }
> m01% g++ -DHAVE_PYTHON_H -I/usr/include/python2.5 fpos_python.cc -lpython2.5 && ./a.out
> sizeof(fpos_t) = 16
> m01% g++ -I/usr/include/python2.5 fpos_python.cc -lpython2.5 && ./a.out
> sizeof(fpos_t) = 12
>
> This breaks my code if I do not include <Python.h> in ALL of my compilation modules (which is not pratical in my opinion).
>
> Is this a known problem? I personally would call this definitely a bug. What is the rational behind changing fpos_t?
Definitely a bug, but the question is why it happens. I don't see any
python headers redefining it. It may be a bug in the system headers
that python is just provoking.
gcc's -save-temps may provide some diagnostics. Also, try moving
#include <stdio.h> above Python.h. I can't think of anything else at
the moment.
--
Adam Olsen, aka Rhamphoryncus
More information about the capi-sig
mailing list