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

16 次查看(过去 30 天)
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'

采纳的回答

MathWorks Support Team
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"
C:\> dumpbin \headers DLL_filename
Fixing the error involves one of the two following options:
1. Run the application under 32 bit MATLAB.
2. Compile the .dll as a 64 bit application.
a. In Visual C project properties, change the Platform to x64.
b. In Visual C project linker library path properties, add "C:\Program Files\Microsoft SDKs\Window\V7.1\Lib\x64 so kernel32.lib is found."

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Environment Customization 的更多信息

标签

尚未输入任何标签。

产品


版本

R2012b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by