[Python-Dev] PEP 384 status
Daniel Stutzbach
daniel at stutzbachenterprises.com
Tue Aug 31 21:36:00 CEST 2010
On Tue, Aug 31, 2010 at 4:54 AM, M.-A. Lemburg <mal at egenix.com> wrote:
> Is it possible to have multiple versions of the lib C loaded
> on Windows ?
>
Yes, and it's a pretty common situation. The fopen() that I call within a
DLL may not be the same fopen() called by another DLL. When writing a DLL
for Windows, the API must be designed with the assumption that anything
returned by the C library cannot be passed a different C library. For
example, suppose I a expose a function in my DLL that allocates some memory,
populates it with useful information, and returns a pointer. I must also
supply a function to free the memory. I cannot ask the caller to simply
call free(), because their free() may not be using the same heap as my
malloc().
Likewise, a FILE * isn't safe to pass around, unless I can guarantee that
the application really is one big happy family compiled against the same
version of the C library.
--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100831/d3259ac1/attachment.html>
More information about the Python-Dev
mailing list