Python 2.6 and wrapping C libraries on Windows
L. Lindstrom
spam-trap at telus.net
Wed Apr 30 21:25:40 EDT 2008
sturlamolden wrote:
> On Apr 30, 8:06 pm, "L. Lindstrom" <spam-t... at telus.net> wrote:
>
>> I have read that Python extension modules must link to the same C
>> run-time as the Python interpreter. This I can appreciate. But does this
>> requirement extend to the C libraries an extension module wraps.
>
> This somewhat of a misconception. You cannot reliably mix and blend
> CRT resources across different CRTs. This is not really a Python
> problem. It applies to any program. The reason this is important for
> Python C extensions, is mainly the possibility of accessing a Python
> file object as a pointer to a FILE struct in C. If you get a FILE*
> pointer from one CRT, you should not pass it to another CRT's fread.
> Likewise, if you allocate memory with one CRT's malloc(), you should
> not release the memory with another CRT's free(). As long as your
> libraries don't share CRT resources, it does not matter that the link
> to different CRTs for their internal work.
>
>
>
>
>
>
SDL has functions for separating memory allocation and file access.
Going back to msvcrt.dll is a last resort. I may have an idea on how to
build it for msvcr90.dll.
--
Lenard Lindstrom
"%s@%s.%s" % ('len-l', 'telus', 'net')
More information about the Python-list
mailing list