[Python-Dev] Python for windows.

M.-A. Lemburg mal at egenix.com
Fri Nov 28 11:33:25 CET 2008

On 2008-11-28 00:15, Christian Heimes wrote:
> Martin v. Löwis wrote:
>>> All, and not to start flames, but I still do not understand why
>>> applink.c isn't included in python's main (conditionally) instead of
>>> expecting users, many of them novices, to do the build.  ???
>> One reason is that I don't know what applink is, and why I should
>> care about it. (I may have known in the past, but then I have forgotten
>> since).
> Applink is roughly explained at
> http://www.openssl.org/support/faq.html#PROG2. The matter was discussed
> about half a year ago but no decision was made. See
> http://mail.python.org/pipermail/python-dev/2008-March/077424.html
> applink.c is just a table of integer constants to function pointers. It
> makes mixing of different CRTs secure. You'll get the idea after reading
> the file, Martin. A similar approach could be useful for Python, too.

So that's why we don't see a problem with pyOpenSSL. From the first

Your application must link against the same version of the Win32 C-Runtime
against which your openssl libraries were linked. The default version for
OpenSSL is /MD - "Multithreaded DLL".

and later on:

As per 0.9.8 the above limitation is eliminated for .DLLs. ...
Instead of re-compiling OpenSSL toolkit, ...[you have to add]
<install-root>/include/openssl/applink.c ... to your application project
or simply #include-d in one [and only one] of your application source files.
[Note that] it is as important to add CRYPTO_malloc_init prior first call
to OpenSSL.

In our eGenix pyOpenSSL distribution we ship the Windows DLLs for
OpenSSL together with the compiled PYDs for pyOpenSSL - all compiled
using the same compiler settings.

Python for Windows does the same, so there should be no issue either.

>From the comment it appears that you only see problems, if you try to use
those extensions from a Python executable that was compiled using
different settings, e.g. an embedded Python interpreter.

Note that neither Python nor pyOpenSSL call the required CRYPTO_malloc_init()
prior to using the other SSL APIs, so even including applink.c would
not help - you have to add this call to the used extensions as well.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Nov 28 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2008-11-12: Released mxODBC.Connect 0.9.3      http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-Dev mailing list