title: Multi-Instance usage of S-Functions (C code) in SIMULINK
body: <p>I have a legacy C function in my SIMULINK model that uses some static variables in its functions. The static variables are available globally. When I reference multiple instance of my model, I get error because my S-function is not configured for that. I am getting this error message because code generation doesn't allow this.</p>
  
  <p>The error message I get is the following:</p>
  
  <blockquote>
    <p>The S-Function block 'ECDCTRL/PULDESC/S-Function Builder' is not supported in multi-instance Normal mode because it does not declare that it supports multiple execution instances. If the S-Function satisfies the multiple execution instances requirements, you can declare this using the SimStruct function 'ssSupportsMultipleExecInstances' in the 'mdlSetWorkWidths' method.</p>
  </blockquote>
  
  <p>I am using the <code>(MYSFUNC)_Outputs_Wrapper.c</code> file when I build it with the auto-generated code. How can I make sure that I can use my legacy C function when using multiple references of my model? SIMULINK website suggests using <code>ssSupportsMultipleExecInstances(SimStruct *S, bool flag)</code> method, but it is not correct as I am not using the <code>SimStruct</code> header files. What is the way around? </p>