简体   繁体   English

我可以在64位python中使用32位dll或exe吗?

[英]Can I use 32bit dll or exe in 64bit python?

When I use CDLL to call 32bit dll in 32bit python, it works well. 当我使用CDLL在32位python中调用32位dll时,它运行良好。 But unfortunatelly in my 64bit win7 os only installs 64bit python, when calling it turns: it is not a effective win32 app! 但是不幸的是,在我的64位win7操作系统中,它只能安装64位python,当调用它时:它不是有效的win32应用程序!

Can I use 32bit dll or exe in 64bit python? 我可以在64位python中使用32位dll或exe吗? Or I have to install 32bit python instead? 还是我必须安装32位python?

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

You'll have to either: 您必须:

  1. Make a 64-bit version of your DLL; 制作DLL的64位版本;
  2. Use a 32-bit version of Python; 使用32位版本的Python; or 要么
  3. Host the DLL in a separate (32-bit) EXE, and use some form of inter-process communication to talk to it from your 64-bit Python process. 将DLL托管在单独的(32位)EXE中,并使用某种形式的进程间通信与您的64位Python进程进行通讯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM