Error using sfcnbuilder.createCompileCSfun Error while obtaining sizes from MEX S-function
古いコメントを表示
Hello together,
I do have troubles compiling a C-Code into a S-function using the S-Function builder block in simulink. I did compile the same code (excluding different library paths obvisouly) with MinGW64 on another Computer using Matlab R2021b and the mex-File works perfectly within the simulink model.
However on the other Laptop with Matlab R2022a the C-Code also is compiled and a mex-File is generated. But immediately after that I receive an error saying:
Error using sfcnbuilder.createCompileCSfun Error while obtaining sizes from MEX S-function 's_fun_name' in 'model_v2/Subsystem/Subsystem1/Subsystem2/C//C++ Code Block'. - Show complete stack trace Caused by: Error using sfcnbuilder.createCompileCSfun Invalid MEX-file 'workingfolder\s_fun_name.mexw64': Das angegebene Modul wurde nicht gefunden. - Show complete stack track
and the all three Code-Files (.c, .c_wrapper & .mexw64) are deleted from the working folder. If you click on show complete stack track nothing happens.
Anybody had similar troubles?
Kind regards
回答 (1 件)
Kausthub
2023 年 12 月 28 日
0 投票
Hi Eyzie,
I understand that you are facing an error while using the S-Function builder to build your S-Function. From the error message, “Error while obtaining sizes from MEX S-Function” is caused due to the “specified module could not be found” error.
I believe that there are two possible reasons for “specified module could not be found” error:
- Some of the required DLL files are missing i.e., you do not have all the necessary libraries that the MEX-function is dependent upon.
- You are running a MEX-file on a different version of MATLAB than it was compiled on.
You could refer to these articles which explains how to solve the error in detail:
- https://www.mathworks.com/matlabcentral/answers/92040-why-do-i-receive-a-specified-module-could-not-be-found-error-while-running-a-mex-file-in-matlab
- https://www.mathworks.com/help/matlab/matlab_external/invalid-mex-file-error.html
- https://www.mathworks.com/matlabcentral/answers/92362-how-do-i-determine-which-libraries-my-mex-file-or-stand-alone-application-requires
Hope it helps!
カテゴリ
ヘルプ センター および File Exchange で Block and Blockset Authoring についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!