I wa testing a small python program that called underlying DLL libs.
My system is 64bit windows 7. The python executable is the one shipped with 64 bit Anaconda3, kicked off inside Anaconda's virtual environment.
First thing came to my attention is that this python code
sys.platform
return win32 even for a AMD64 Arch, "platform.machine()" seemed returning a more accurate result.
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] on win32
I did find some SO posts discussing this issue, such as this one.
and then the program failed when trying to load a DLL file:
windll.LoadLibrary(realpath(join(_module_location, 'dlh', 'win64', 'I_cant_tell_you_the_name.dll')))
Error message:
OSError: [WinError 193] %1 is not a valid Win32 application
Question is, why python can't load a 64 bit DLL in a 64 bit environment? it seemed to me the compiler insisted on loading a 32 bit DLL instead. Why is that? Or that the venv that Anaconda created support only 32 bit code?
Unfortunately I didn't have a 32 bit DLL for testing, otherwise I'd like to see how that went.