Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用MSVC编译ssl,主机应用程序崩溃(不在调试器中!)_Python_Windows_Debugging_Visual C++_Access Violation - Fatal编程技术网

Python 使用MSVC编译ssl,主机应用程序崩溃(不在调试器中!)

Python 使用MSVC编译ssl,主机应用程序崩溃(不在调试器中!),python,windows,debugging,visual-c++,access-violation,Python,Windows,Debugging,Visual C++,Access Violation,我正在尝试使用MSVC编译器在Windows for Python 2.6上编译\u ssl模块,因为嵌入到主机应用程序中的Python运行时是使用此编译器和此版本构建的。然而,运行时在Windows上没有本机ssl支持,不是因为它不受支持,而是因为(在官方声明中)尚未检查许可证是否与封闭源代码应用程序兼容 我已经从Python主页下载了,并将\u ssl.c和socketmodule.h(ssl模块源代码要求包含)提取到一个单独的文件夹中。我还下载了win32版本,以便将其与ssl模块源链接

我正在尝试使用MSVC编译器在Windows for Python 2.6上编译
\u ssl
模块,因为嵌入到主机应用程序中的Python运行时是使用此编译器和此版本构建的。然而,运行时在Windows上没有本机ssl支持,不是因为它不受支持,而是因为(在官方声明中)尚未检查许可证是否与封闭源代码应用程序兼容

我已经从Python主页下载了,并将
\u ssl.c
socketmodule.h
(ssl模块源代码要求包含)提取到一个单独的文件夹中。我还下载了win32版本,以便将其与ssl模块源链接

我的生成命令如下所示:

cl /I"C:\path\to\host\python\runtime\include" /I"include/" _ssl.c /Fo"_ssl.obj" /c
link _ssl.obj /DLL "C:\path\to\host\python\runtime\libs\python26.lib" lib/libeay32.lib lib/ssleay32.lib Ws2_32.lib /OUT:_ssl.pyd
libeay32.lib
ssleay32.lib
来自openssl for windows发行版。该模块编译良好,并输出一个88KB的共享库

问题

当我启动主机应用程序并运行命令调用Python运行时运行代码导入并使用最近编译的
\u ssl
模块时,应用程序崩溃。宿主应用程序有自己的异常处理程序,在崩溃时编写错误报告

Exception
{
    ExceptionNumber = 0xC0000005
    ExceptionText = "ACCESS_VIOLATION"
    Address = 0x01A27058
    Thread = 4776
    Last_Error = 0x00000000
}
异常点的调用堆栈不会在任何与Python相关的过程中结束。我假设在触发这个地方的错误之前发生了不正确的事情

古怪

当我从Win32调试器(WinDbg)运行应用程序时,不会发生此错误,并且一切运行正常

问题

编译
\u ssl
模块有什么不对,或者什么可能触发此异常

其他信息

  • 嵌入式Python运行时如下所示:
    2.6.4(r264:757062012年3月6日02:32:04)[MSC v.1600 32位(英特尔)]

崩溃最终是由于主机应用程序中的错误造成的。但是,此错误只有在从web获取数据时才会发生,这仅在ssl模块中才可能发生。

VS C编译器使用不同的C运行时库进行调试和发布版本,这可能是原始问题和调试器中的奇怪之处的线索。基本上,所有内容,包括openssl for windows发行版和Python本身,都必须编译为使用相同版本的运行库。它们也必须使用相同版本的VS进行编译。