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!
当我使用CDLL在32位python中调用32位dll时,它运行良好。但不幸的是,在我的64位win7操作系统中只安装64位python,当它转过来时:它不是一个有效的win32应用程序!
Can I use 32bit dll or exe in 64bit python? Or I have to install 32bit python instead?
我可以在64位python中使用32位dll或exe吗?或者我必须安装32位python而不是?
1 个解决方案
#1
26
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?
64位EXE无法加载32位DLL。 (反之亦然:32位EXE无法加载64位DLL。)毕竟,他们无法就指针的大小达成一致 - 如果EXE在4GB边界之上分配内存并希望通过该指针,会发生什么情况指向32位DLL的指针?
You'll have to either:
你必须要么:
- Make a 64-bit version of your DLL;
- 制作64位版本的DLL;
- Use a 32-bit version of Python; or
- 使用32位版本的Python;要么
- 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.
- 在单独的(32位)EXE中托管DLL,并使用某种形式的进程间通信从64位Python进程与它进行通信。
#1
26
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?
64位EXE无法加载32位DLL。 (反之亦然:32位EXE无法加载64位DLL。)毕竟,他们无法就指针的大小达成一致 - 如果EXE在4GB边界之上分配内存并希望通过该指针,会发生什么情况指向32位DLL的指针?
You'll have to either:
你必须要么:
- Make a 64-bit version of your DLL;
- 制作64位版本的DLL;
- Use a 32-bit version of Python; or
- 使用32位版本的Python;要么
- 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.
- 在单独的(32位)EXE中托管DLL,并使用某种形式的进程间通信从64位Python进程与它进行通信。