[Python-Dev] Python for windows.
Bugbee, Larry
larry.bugbee at boeing.com
Thu Nov 27 02:09:56 CET 2008
> > 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).
Yeah, it's been a while for me too.
As I recall, OpenSSL, a long while ago stopped, supporting some idiosyncrasies associated with Windows I/O and opted for a "cleaner" approach, that of requiring developers to link a small file, applink.c, into the app's main. applink.c is provided by the OpenSSL folks.
>From http://www.openssl.org/docs/crypto/OPENSSL_Applink.html:
OPENSSL_Applink is application-side interface which
provides a glue between OpenSSL BIO layer and Win32
compiler run-time environment. Even though it appears
at application side, it's essentially OpenSSL private
interface. For this reason application developers are
not expected to implement it, but to compile provided
module with compiler of their choice and link it into
the target application. The referred module is available
as <openssl>/ms/applink.c.
For most custom apps this is a simple process of adding "#include applink.c" to the app's main(). The problem for Python developers is that their Python program is not main(), and if python.exe does not have the OPENSSL_Applink interface, they cannot import M2Crypto, pyOpenSSL, or use ctypes to wrap OpenSSL, and write a PEM file without throwing an error. (That said, Daniel Clark says he is not experiencing problems with NCrypt. I have not verified.)
One solution is for those users to build their own Python from scratch. Many/most cannot do it, especially if they don't have the right version of Visual Studio. I know I don't. I simply stopped developing on Windows.
Arguably better is to have the include statement in the python source file, python.c, appropriately conditioned. ...and to provide a copy of applink.c. That way, there would be no more need to try to find or do a custom build. Everybody building for a Windows platform will have applink included and access to OpenSSL becomes a non-issue.
Larry
More information about the Python-Dev
mailing list