Determining selected MEX compiler inside m-Function running in Simulink
Afficher commentaires plus anciens
I am attempting to determine the active MEX compiler inside a MATLAB function that is called by a MATLAB function block in Simulink. I need to do this because this function also calls an external library and depending on what compiler is selected, my function needs to source the correct version of the shared library for use. I have tried the following in my code:
coder.extrinsic('mex.getCompilerConfigurations');
comp_C.ShortName = ' ';
comp_CPP.ShortName = ' ';
comp_C_info = ' ';
comp_CPP_info = ' ';
comp_C=coder.const(mex.getCompilerConfigurations('C','Selected'));
comp_CPP=coder.const(mex.getCompilerConfigurations('C++','Selected'));
comp_C_info=comp_C.ShortName;
comp_CPP_info=comp_CPP.ShortName;
if contains(comp_C_info,'mingw64') && ...
contains(comp_CPP_info,'mingw64-g++')
comp = 1;%minGW
elseif contains(comp_C_info,'MSVC') && ...
contains(comp_CPP_info,'MSVCPP')
comp = 2;%Visual Studio
end
The error I receive back is:
This 'mex.CompilerConfiguration' constant could not be eliminated.
Function 'foo.m' (#65.46734.46781), line 924, column 26:
"mex.getCompilerConfigurations('C++','Selected')"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
This 'mex.CompilerConfiguration' constant could not be eliminated.
Function 'foo.m' (#65.46661.46706), line 923, column 24:
"mex.getCompilerConfigurations('C','Selected')"
Launch diagnostic report.
Component:MATLAB Function | Category:Coder error
If my method is correct, how do I correct this error? If not, what is the better way to identify the active MEX compiler, in this context?
Thanks!!!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Deployment, Integration, and Supported Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!