## How do I resolve 'LoadLibrary failed with error 193: %1 is not a valid Win32' error message in Simulink 8.1 (R2013a)?

### MathWorks Support Team (view profile)

on 6 May 2013
Accepted Answer by MathWorks Support Team

### MathWorks Support Team (view profile)

I have an S Function block in which I am trying to load a DLL generated using Microsoft Visual Studio. I am using 64 bit MATLAB. I am able to generate the .mexw64 file. However, when I try to simulate the Simulink model that contains the S Function block, I got the following error in a popup window:
'LoadLibrary failed with error 193: %1 is not a valid Win32'

### Tags

No tags entered yet.

R2012b

### MathWorks Support Team (view profile)

on 6 May 2013

The "LoadLibrary failed with error 193: %1 is not a valid Win32" means that a 64 bit operating system is trying to load a 32 bit Win32 file.
You can check the bitness of the DLL file using dumpbin. You can do so at the Windows Command Prompt:
C:\> call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"