Can I use custom libraries (.dll/.lib/.so/.a) with Simulink Real-Time?

34 views (last 30 days)
Are custom libraries (.dll/.lib/.so/.a) supported for integration with my real-time model running on Speedgoat hardware when using Simulink Real-Time (SLRT)?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 Feb 2024
Edited: MathWorks Support Team on 18 Feb 2024
Custom libraries are generally supported with Simulink Real-Time (SLRT), as long as they have been compiled with the same compiler that Simulink Real-Time uses. Depending on the MATLAB release that you are using, please note the following details:
 

For R2020b and newer:

Simulink Real-Time has adopted the  QNX Neutrino 64-bit Real-Time Operating System (RTOS) and supports dynamic (.so) and static libraries (.a). These libraries must be compiled with the QNX C/C++ compiler (qcc) compiler matching the version included in the Simulink Real-Time Target Support Package. To utilize shared dynamic objects, they must first be transferred to the target's filesystem, whereas static libraries are incorporated directly into the real-time application file on the host.
The following tutorial is a great resource to get started:
The following documentation page demonstrates how the QNX compiler (QCC) can be used to compile source code into a library, specifically within the context of FMUs:
 

For R2020a and earlier:

Simulink Real-Time operates on a Win32 API-compatible 32-bit RTOS. Only static libraries (.lib) are supported. To compile these libraries for linkage with your S-Function on a Speedgoat target, they must be constructed as 32-bit libraries utilizing Visual Studio. It is important to note that dynamic libraries (.dll) are not supported.
Once you have both 32-bit (for the target) and 64-bit (for the host) versions of your libraries, you can use the "rtwmakecfg.m" method to add the libraries to the build process:

More Answers (0)

Categories

Find more on Get Started with Simulink Real-Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!