File objects in extension module
Gordon McMillan
gmcm at hypernet.com
Wed Apr 7 15:10:45 EDT 1999
Mike Steed writes:
>
> I am trying to use a file object passed from Python to a C extension
> module (Windows 98). All the C runtime calls crash when I pass them
> the FILE pointer (fwrite, fflush, etc.)
>
> The pointer I get back from PyFile_AsFile seems okay -- the struct
> members have reasonable values, etc.
>
> I have seen the same behavior with MS VC++ (4.2) and egcs/mingw32
> (1.1.2), and with Python-1.5.1 and 1.5.2b2.
>
> What am I missing?
You need the same build / link options as Python - specifically, you
need to use the Multithreaded DLL for c runtime support. Otherwise
you're trying to manipulate one file from 2 separate copies of the c
runtime. Kablooie.
- Gordon
More information about the Python-list
mailing list