Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

32-bit PYD requires 64-bit MSVC DLL

2 REPLIES 2
Reply
Message 1 of 3
herufeanor
987 Views, 2 Replies

32-bit PYD requires 64-bit MSVC DLL

Using the 2017 Python FBX SDK, when I use the files located in lib\Python27_x86\, and use the 32-bit version of msvcr110.dll and msvcp110.dll, I get this error:

 

Traceback (most recent call last):
  File "Source/imvu/FbxFileTest.py", line 6, in <module>
    import FbxCommon as fbx
  File "Z:\stable\Binaries\FbxCommon.py", line 1, in <module>
    from fbx import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

 

That rather confusing error message usually indicates you're trying to load a 32-bit DLL as a 64-bit DLL. And lo and behold, if I use the 64-bit version of msvcr110.dll and msvcp110.dll, it all works.

 

So for some reason the 32-bit version of your library is requesting the 64-bit MSVC redistributables. Which makes me suspect that the libraries you've labeled as 32-bit aren't actually 32-bit at all.

2 REPLIES 2
Message 2 of 3
regalir
in reply to: herufeanor

Hi,

 

can you write down the steps you performed to get to this error?

I checked the .pyd files and they are, as expected 32 bits. I also looked at the build settings and, again, the 32 bit flags are correctly set. I also tried to import FbxCommon.py into Python27 (32bit) and again, no errors!

 

At this point, I am confused how you get the errors.

The only way I can get the error:

 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27_x86\lib\site-packages\FbxCommon.py", line 1, in <module>
    from fbx import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

 

Is if I install the 64 bit version of the fbxsip.pyd and fbx.pyd files in the 32 bit python site-packages (or the 32 bit version in the 64 bit python)

Message 3 of 3
herufeanor
in reply to: regalir

Our Python is definitely 32-bit.

 

I copied all the files out of 2017.0.1/lib/Python27_x86 directory into the working directory of my Python program, then attempted to run it, and it worked fine. However, when I attempted to run my program on a non-development box (as a Python executable, so it had the Python runtime packaged into the exe), it failed because it lacked the MSVC redistributable. This made sense, as my dev machine had that redistributable installed in the OS. So I went into the Windows/System32 directory, and pulled out msvcr110.dll and msvcp110.dll, and included them with the program. Then I again attempted to run this on the non-development machine. This is when I first saw the "DLL load failed: %1 is not a valid Win32 application." error.

 

Confused, I attempted to reproduce this on my local machine. In order to make sure it was loading the right DLLs, I first removed the DLLs from the working directory, and then from Windows/System32. This SHOULD have caused it to fail due to missing DLLs, but to my surprise, it still worked. I then went and found the matching DLLs from Windows/SysWOW64, and tried again. This time, it failed due to missing DLLs. This is where I really got confused. How could the 32-bit Python with the 32-bit FBX SDK be requiring the 64-bit MSVC redistributable?

 

So I set out to confirm this is what was going on. I re-copied the files from 2017.0.1/lib/Python27_x86, to make sure I was using a 32-bit PYD. Which should have been a given, since it was working with my 32-bit Python. It shouldn't have been possible in any circumstance for a 32-bit Python to load a 64-bit MSVC redistributable, so it was clearly time to check my assumptions. This didn't make a difference. I removed BOTH the 32-bit and 64-bit MSVC redistributables from my Windows directory. I copied the 32-bit ones into my program's working directory, and got the "DLL load failed: %1 is not a valid Win32 application." I removed those again, and copied the 64-bit ones into my program's working directory, and it worked.

 

By my understanding of how things work, this should not be possible. A 32-bit process should not ever be capable of loading a 64-bit DLL. But then, I don't know what kind of weird shenanigans Python may be pulling under the hood.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report