Python extensions in C... and stdout problems!

Penfold spam at spam.com
Mon Aug 14 19:44:31 EDT 2000


Victor B. Putz <vputz at nyx.net> wrote in message
news:8n7hb5$iuc at edrn.newsguy.com...
> Ran into an irritating problem with gcc 2.95, Python 1.5.2, and building a
> shared-module extension module in C.
>
> The essence of the problem is that any C function which references stdout
(and I
> assume stdin or stderr) crashes the program and interpreter immediately.
[gratuitous source clipped]
I dont know what platform you're having problems but I'll assume its Windows
;-), thats where this problem usually
crops up !!  If so, this problem is probably not to with stdout, but files
in general.

All extensions must compile against the same library that Python was built
against.  On windows Python is built against MSVCRT
while gcc tends to build against crt, the "older" c runtime.  Unfortunately
these have vastly different ideas about what a FILE struct is
and tend not to play with each other.  MSVCRT just packs ups its toys and
goes home if you pass it a CRT version [Not an
unreasonable thing to do really ;-) ].

So anyway, the be all and all of "Compiling Python extensions on Windows
with mingw32/gcc without crashing more than a derby driver" guide
can be found at
http://starship.python.net/crew/kernr/mingw32/Notes.html

Have a nice day !!

Des.
PS Please note your platform if you have problems in future, despite Bills
delusions of grandeur, the whole world may not be running
the "one true platform" ;-).






More information about the Python-list mailing list