Creating a DLL

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 connectors, the connector names make it easy to identify the correct wiring paths

To create a DLL

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 so.

3.    Select the compound block.

4.    The first time you generate code, choose Tools > Code Gen. For subsequent code generation, press SHIFT+right-click and click Compile to automatically generate code based on the selections in the Code Generation dialog.

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.

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 to allow 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


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.

12.  Click Done.