C-Code Level 2 S-Function Name
古いコメントを表示
Hey,
I have a verry basic problem. I want to create a C-Code Level 2 S-Function using the mex command. I want to chance the name of the mex-file (mexw32) but not the name of the c-file.
Therefore I tried to change my trusty old friend timestwo.c.
#define S_FUNCTION_NAME sfun_timestwo
#define S_FUNCTION_LEVEL 2
#include "simstruc.h"
I tried to use the lcc-win32 and the MS SDK 7.1 compiler. My MatLab version beeing R2013a.
When I use
mex timestwo.c
the outcome is allways timestwo.mexw32 but not sfun_timestwo.mexw32.
Of cause I get an object name error when I try to run a simulation containing this S-Function.
"Error while obtaining sizes from MEX S-function 'timestwo' in 'timestwo_mdl/S-Function'.
S-function name mismatch. Name in source is "#define S_FUNCTION_NAME sfun_timestwo", whereas name of the S-function MEX file is "timestwo". The source needs to be updated"
What is the meaning of the first define (S_FUNCTION_NAME)? Isn't it possible to have different S-Function names and sorce-filce names?
Thank you in advance
回答 (1 件)
Walter Roberson
2015 年 9 月 2 日
1 投票
No it is not. The s-function will be loaded as a .mex* (effectively a .dll), so the name used by Simulink needs to match the name of the symbol in the file.
カテゴリ
ヘルプ センター および File Exchange で Create C/C++ S-Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!