Can I use custom libraries (.dll/.lib/.so/.a) with Simulink Real-Time and Speedgoat?
29 views (last 30 days)
Show older comments
MathWorks Support Team
on 16 May 2022
Edited: MathWorks Support Team
on 12 Sep 2025
I am trying to include custom code in my Simulink Real-Time simulation that depends on static or dynamic runtime libraries. Are custom Windows libraries (.dll/.lib) or Unix libraries (.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
on 12 Sep 2025
Edited: MathWorks Support Team
on 12 Sep 2025
Custom libraries are generally supported with Simulink Real-Time (SLRT), as long as they are compiled with the same compiler used by Simulink Real-Time. The specific details depend on the MATLAB release you are using:
Simulink Real-Time has adopted the POSIX-based BlackBerry® QNX Neutrino® 64-bit Real-Time Operating System (RTOS) and supports both dynamic (.so) and static libraries (.a). Windows libraries (.dll/.lib) are not supported in these versions.
These .so and .a libraries must be compiled with the proprietary QNX C/C++ compiler (qcc) compiler matching the version included in the Simulink Real-Time Target Support Package. To utilize shared dynamic libraries (.so), these must be transferred to the target's filesystem before use. Static libraries (.a), on the other hand, are directly integrated into the real-time application file on the host.
For a detailed guide on integrating external code and libraries, refer to the link below. The "Additional C/C++ Project for Simulink Real-Time" section at the bottom of the page has a reference to a full example hosted on GitHub:
Additionally, you can learn how to cross-compile source code into a library using the QNX compiler (QCC) within the context of FMUs from this documentation:
Simulink Real-Time operates on a Win32 API-compatible 32-bit RTOS. Only static libraries (.lib) are supported. Windows dynamic libraries (.dll) and Unix libraries (.so/.a) are not supported.
To use these libraries with your S-Function on a Speedgoat target, they must be compiled as 32-bit libraries using Visual Studio. Ensure you have both 32-bit (for the target) and 64-bit (for the host) versions of your libraries. You can then use the "rtwmakecfg.m" method to add the libraries to the build process.
For more information on customizing generated makefiles and adding build dependencies, see:
0 Comments
More Answers (0)
See Also
Categories
Find more on Troubleshooting in 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!