我可以在64位python中使用32位dll或exe吗? [英] Can I use 32bit dll or exe in 64bit python?

查看:1751
本文介绍了我可以在64位python中使用32位dll或exe吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用CDLL在32位python中调用32位dll时,它运行良好。
但不幸的是,在我的64位win7操作系统中,它只能安装64位python,调用时会变成:它不是有效的win32应用程序!

When I use CDLL to call 32bit dll in 32bit python, it works well. But unfortunatelly in my 64bit win7 os only installs 64bit python, when calling it turns: it is not a effective win32 app!

我可以使用32位dll还是EXE在64位Python?还是我必须安装32位python?

Can I use 32bit dll or exe in 64bit python? Or I have to install 32bit python instead?

推荐答案

64位EXE无法加载32位DLL。 (反之亦然:32位EXE无法加载64位DLL。)毕竟,它们不能就指针的大小达成共识-如果EXE分配的内存超过4GB边界并希望传递该指针,将会发生什么情况?指向32位DLL的指针?

64-bit EXEs cannot load 32-bit DLLs. (And vice versa: 32-bit EXEs cannot load 64-bit DLLs.) After all, they can't agree on the size of a pointer -- what would happen if the EXE allocated memory above the 4GB boundary and wanted to pass that pointer to the 32-bit DLL?

您将必须:


  1. 制作64位版本的DLL;

  2. 使用32位版本的Python;或

  3. 将DLL托管在单独的(32位)EXE中,并使用某种形式的进程间通信与您的64位Python进程进行通讯。

这篇关于我可以在64位python中使用32位dll或exe吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆