MATLAB: Is it possible to configure whether an S-function supports multiple execution instances using the Legacy Code Tool in Simulink 7.6 (R2010b)

simulink

In C-MEX S-functions, it is possible to include a call to the 'ssSupportsMultipleExecInstances' function. This function allows you to set a flag to true or false indicating whether or not that S-function supports multiple execution instances. This determines whether a 'For Each' Subsystem block will support that S-function operating inside the subsystem.
When the S-function source file is generated using the Legacy Code Tool, I need to manually go into the generated C file and add in the call to 'ssSupportsMultipleExecInstances'. I was wondering if there is a way for Legacy Code Tool to do this automatically.

Best Answer

This change has been incorporated into the documentation in Release 2012a (R2012a). For previous releases, read below for any additional information:
Documentation on this feature is missing from the Simulink 7.6 (R2010b) documentation for the legacy code tool.
Here is additional information on this feature:
To configure whether an S-function supports multiple execution instances using the Legacy Code Tool, call the tool using the following syntax:
>> def = legacy_code('initialize')
>> def.Options.supportsMultipleExecInstances=true
'supportsMultipleExecInstances ' is an additional field for the Options structure that is used to define options for the generated S-function.