MATLAB: Static Functions in Real Time workshop

functionsreal time workshopsimulinkstatic

Hi,
Is it possible to generate static functions instead of extern functions when using Real Time workshop? My problem is that when two seperate real time workshop codes are combined together, errors are generated due to the function names being redundant. So I am having to manually rename the functions as static once the code is generated. Is there any method of automatically defining them as static when real time workshop is used to convert the model to C code?
Eg: The functions I have problems with are – rt_GetLookupIndex, rt_Lookup and rt_Lookup2D_Normal. These are generated by Real Time Workshop when converted to C codes and they are defined as extern instead of static, which I need.
Regards, DPac

Best Answer

These are generally utility functions which are generated with tha same name in different model. One option is that, you can generate these functions in separate file and use only this file. All model will call function from this file. To achieve this goto-
Configuration parameters> RealTime Workshop> Interface tab and select Utility function generation option as shared location.
Second and not recommended option is that, you can modify TLC file of corresponding utility functions to generate the function with unique name or as static. For example by modifying TLC you can force the RTW to generate functions with names like modelname_rt_GetLookupIndex. In this way function names will be different for different model names.