To compile a Fixed-Point S-function, additionnal steps must be used compared to standard C-MEX S-function.
Before compiling the S-function, include files "fixedpoint.c" and "fixedpoint.h" in the S-function. Details on how to include these files can be found in the following documentation:
Structure of the S-Function:
web([docroot,'/toolbox/fixpoint/ug/f8840.html'])
or online at:
On UNIX systems, to create a MEX-file for a user-written fixed-point S-function, you need to pass an extra argument, -lfixedpoint, to the mex command. For example:
mex('sfun_user_fxp_asr.c','-lfixedpoint')
On Windows systems, to create a MEX-file for a user-written fixed-point S-function, an extra argument must be passed to the mex command that identifies the appropriate version of libfixedpoint.lib. The version of libfixedpoint.lib to use depends on the compiler specified using mex -setup. The possible versions, which are installed with Simulink software, are as follows:
extern\lib\win32\lcc\libfixedpoint.lib
extern\lib\win32\microsoft\libfixedpoint.lib
extern\lib\win32\watcom\libfixedpoint.lib
For example, if Version 6.0 of the Microsoft® Visual C++® software is the compiler that the mex command is configured to use, the command to create the MEX-file is:
mex('sfun_user_fxp_asr.c',[matlabroot,'\extern\lib\win32\...
microsoft\libfixedpoint.lib'])
The documentation on that topic is located at:
Creating MEX-Files
web([docroot,'/toolbox/fixpoint/ug/f17375.html'])
or online at:
Best Answer