Chapter 2 C Language ReferenceAutoCode Reference 2-20 ni.comLinking a Variable Interface UCB with the SimulatorUnlike the fixed interface which provides an automatic method for linkingwith the Simulator, the variable interface is too complicated for thatmethod. As a result, you are required to create a “wrapper” function thatinterfaces between the Simulator and your code. For information on how tocreate the wrapper for the Simulator, refer to the SystemBuild User Guide.Procedure SuperBlocksThis section describes how to generate and link Procedure SuperBlocks.Generating Reusable ProceduresGenerate a reusable procedure from your Procedure SuperBlock asdescribed in Chapter 3, Ada Language Reference. Refer to callout 1of Figure 2-4. Along with the algorithmic procedure (refer to callout 2),AutoCode also generates the respective hook procedure or wrapper(refer to callout 3) for automatic linking with the SystemBuild simulator.Refer to Chapter 5, Generated Code Architecture, and Chapter 9, GlobalScope Signals and Parameterless Procedures, for more information aboutgenerating procedures.Linking Procedures with the SystemBuild SimulatorReplace the procedure SuperBlock with a UserCode Block (UCB), referto callout 4 of Figure 2-4 and place the appropriate file name and functionname in the UCB dialog box entries. The function name should be that ofthe Procedure SuperBlock with _ucbhook appended to it.When simulating the model, the SystemBuild simulator automaticallycompiles and links the generated code, and executes the simulation with thenew code library created at this point.If more than one Procedure SuperBlock resides in the top-level discreteSuperBlock from which the procedures are generated, AutoCode will onlygenerate a UCB wrapper for the first Procedure SuperBlock it encounters.If you want to generate wrappers for the other Procedure SuperBlocks,place each Procedure SuperBlock in a separate Discrete SuperBlock andgenerate code. You can also modify the template file to generate wrappersfor all procedures in your model by invoking the TPL functionproc_ucb_hook on all Procedure SuperBlocks. Notice how defaulttemplate file c_sim.tpl invokes proc_ucb_hook for one ProcedureSuperBlock, modify it to loop on all Procedure SuperBlocks, and invoke