Only compound blocks can be converted into DLLs. When a compound block is converted into a DLL, the DLL retains the step size and the integration method in use at the time of DLL generation, and not those selected or specified by the diagram calling the DLL. The DLL does, however, use the simulation start and end times of the diagram that calls it.
The generated DLL includes the block and connector names. When the resulting DLL has numerous input and output connector tabs, the connector names make it easy to identify the correct wiring paths
1. Open the diagram that contains the blocks you want to convert into a DLL.
2. Collapse the blocks into a compound block, if you have not already done.
3. Select the compound block.
4. Choose Tools > Code Gen.
The Result File box displays diagram-name.C, where diagram-name is the name of the current diagram. By default, Embed uses the diagram name as the name for the DLL. For example, if you enter ACI33SIM.C, Embed creates a DLL called ACI33SIM.DLL.
5. If you are creating more than one DLL from a single diagram, give each DLL a unique name.
6. The Result Dir box indicates where the DLL will be stored. To change the location, click ….
7. The Target box contains the target platform for code generation. Choose Host, if it is not already selected.
8. Activate Use selected compound edge pins for data exchange. This parameter allows the generated code to include calls to send data to and receive data from Embed. This parameter is dimmed when no compound block is selected.
9. Choose from the following parameters:
Activate this parameter |
To |
Add Stack Check Code |
Do not activate. |
Call from Foreign RTOS/User App |
Do not activate. |
Check for Performance Issues |
Do not activate. |
Embed Maps in Code |
Insert map file contents directly into the generated code. When this parameter is activated, the resulting executable will be portable because the map file is no longer needed. |
Heap Size |
Does not apply. |
Include Block Nesting as Comment |
Include comments in the generated code that indicate the compound blocks that correspond to the code. |
On-Chip RAM Only |
Does not apply. |
Optimization Level |
Specifies compiler optimization level, from 0 (no optimization) to 4 (highest level). In rare circumstances, Level 4 may yield inconsistent results, necessitating a lower level of optimization. |
Periodic Function Name |
Does not apply. |
Stack Size |
Does not apply. |
Target FLASH |
Does not apply. |
Use selected compound edge pins for data exchange |
Creates the DLL. |
10. Click Compile.
11. Embed opens a text window in which it displays DLL creation. When the DLL has been generated, press any key to return to the Code Generation Properties dialog box.
12. Click Done.