Simulink Sfunction Error - not a valid Win32 application

15 ビュー (過去 30 日間)
Chris
Chris 2014 年 6 月 17 日
コメント済み: Abdulla Hammad 2016 年 8 月 5 日
Since I have installed a Windows update I am getting the following error: Error calling generated SFunction, XXXX_sfun. Invalid MEX-file 'H:\MATLAB\XXXX_sfun.mexw64': H:\MATLAB\XXXX_CTD_sfun.mexw64 is not a valid Win32 application.
If I remove one of the SFunctions from the model I no longer get the error. If I put that SFunction back into the model and remove a different SFunction from the model I no longer get the error.
There are no global variables.
The model worked before the Windows update. I have changed some formulas in the functions but nothing too significant. Running the Matlab code associated with the SFunctions by itself works fine, so I don't think it is a coding bug.
Not sure where to go from here.

回答 (2 件)

Madhura Suresh
Madhura Suresh 2014 年 6 月 17 日
It is possible that the bitness of the S function and MATLAB or some of the modules have a bitness mismatch. Is it possible that the S function module is 32 bit, and everything else might be 64 bit? You can check the bitness of MATLAB by using
>> mexext
  1 件のコメント
Chris
Chris 2014 年 6 月 17 日
mexext gives me mexw64 as I would expect. I don't understand why the S function module would be 32 bit? The module is compiled in a 64 bit version of Simulink running on Windows 7.

サインインしてコメントする。


Kaustubha Govind
Kaustubha Govind 2014 年 6 月 17 日
My guess is that your update either wiped out your system PATH environment variable or uninstalled your Visual C++ redistributables (these are runtime libraries that binaries compiled with Visual Studio depend on). I would recommend trying to reinstall the Visual C++ redistributables corresponding to the version of Visual Studio that you used to compiled the MEX-files. You should be able to find them from Microsoft's Download Center.
If that doesn't help, you can use Dependency Walker to figure out if you are missing any other dependencies.
  4 件のコメント
Chris
Chris 2014 年 7 月 11 日
Both DLLs exist on the machine. In regards to the System PATH variable, I assume you are referring to the MATLAB Path. If this is the case then no they are not in any of these Paths. They are primarily located in "C:\Windows\winsxs\" path. But I would assume the location would be more related to the compiler, rather than Matlab.
Abdulla Hammad
Abdulla Hammad 2016 年 8 月 5 日
Dependency Walker was a very useful tip. I discovered I am using a Win32 bit version of the DLL instead of 64bit.
Thank you Kaustubha Govind, Abdulla

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeC Shared Library Integration についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by