Interface to a Host Simulator Using a Shared Library

This example shows the use of a shared library generated using the system target file ert_shrlib.tlc for a single-rate discrete-time model.

Open Example Model

Open the example model rtwdemo_shrlib.


An 8-bit counter feeding a triggered subsystem is parameterized with constants INC=1, LIMIT=4, and RESET=0. The I/O for the model is Input and Output. The Amplifier subsystem amplifies the input signal by a gain factor K=3. The output signal is updated whenever signal equal_to_count is true. The shared library generated from this example can be dynamically loaded from another application. See rtwdemo_shrlib_app.c for an application example written in C language.


  1. View the configuration on the Code Generation tab of the Configuration Parameters dialog box by clicking the yellow button in the model.

  2. Double-click the blue button in the model to build and run an example application that uses the generated shared library. Click the white buttons to view the source code.

Was this topic helpful?