From: gmcm at hypernet.com (Gordon McMillan)
Date: Wed, 7 Apr 1999 19:10:45 GMT
Subject: File objects in extension module
In-Reply-To: <370B9414.68053816@natinst.com>
References: <370B9414.68053816@natinst.com>
Message-ID: <1288610052-78686891@hypernet.com>
X-UID: 839                                                  

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




