MATLAB: Do I get error messages when compiling a model that contains an S-function block that uses the external S-function module in Real-Time Workshop

%sfunctionrealsimulink codertime

I have a model that contains S-functions.
Under the S-function modules, I have put a library called user32.lib.
When I try to generate code for the GRT target, I receive the following errors:
### Linking ...
\\Mathworks\devel\archive\R2006a\perfect\matlab\sys\perl\win32\bin\perl \\Mathworks\devel\archive\R2006a\perfect\matlab\rtw\c\tools\mkvc_lnk.pl testss.lnk testss.obj rt_nonfinite.obj testss_data.obj grt_main.obj rt_sim.obj
link /RELEASE /INCREMENTAL:NO /NOLOGO -subsystem:console,4.0 kernel32.lib ws2_32.lib mswsock.lib advapi32.lib libcp.lib \user32.lib \\Mathworks\devel\archive\R2006a\perfect\matlab\rtw\c\lib\win32\rtwlib_vc.lib @testss.lnk -out:..\testss.exe
LINK : fatal error LNK1181: cannot open input file '\user32.lib'
NMAKE : fatal error U1077: 'link' : return code '0x49d'
Stop.
It seems that the file name "user32.lib" was converted to "\user32.lib" during Real-Time Workshop build process.

Best Answer

This problem results from incorrect usage. The S-Function modules parameter should be used only to list source files. If an S-Function requires a specific library to be linked in, the full path to that library file should be specified via:
Configuration parameters -> Real-Time Workshop -> Custom Code -> Libraries
or by using the rtwmakecfg.m API
Information about using the rtwmakecfg.m API can be found in this URL:
<http://www.mathworks.com/help/releases/R2011a/toolbox/rtw/ug/bp67s_y-1.html#bp67trh>