Documentation

Interface to a Development Computer Simulator Using a Shared Library

Generate a shared library for interfacing to a simulator that runs on your development computer. Generate the shared library by using the system target file ert_shrlib.tlc.

Open Example Model

Open the example model rtwdemo_shrlib.

open_system('rtwdemo_shrlib');

Model Characteristics

Model rtwdemo_shrlib is a single-rate discrete-time model.

In the model, an 8-bit counter feeding a triggered subsystem is parameterized with constants INC=1, LIMIT=4, and RESET=0.

Model I/O 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.

The example application rtwdemo_shrlib_app.c includes code for dynamically loading the shared library file.

Instructions

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

  2. Build the model and run an example application that uses the generated shared library by double-clicking the blue button in the model.

  3. View the source code by clicking the white buttons in the model.

More Information

For more information about using a shared library, see Package Generated Code as Shared Object Libraries.

Was this topic helpful?