On Tue, Aug 31, 2010 at 4:54 AM, M.-A. Lemburg <m...@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>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to