Clear Filters
Clear Filters

Error using sfcnbuilde​r.createCo​mpileCSfun Error while obtaining sizes from MEX S-function

21 views (last 30 days)
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

Answers (1)

Kausthub
Kausthub on 28 Dec 2023
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:
Hope it helps!

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!