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

11 views (last 30 days)
Are custom libraries (.dll/.lib/.so/.a) supported on Speedgoat targets with Simulink Real-Time (SLRT)?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 16 May 2022
Custom libraries (.lib/.so/.a) are supported with Simulink Real-Time 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:
In R2020b and later, Simulink Real-Time uses the QNX 64-bit RTOS and supports dynamic (.so) and static libraries (.a). In both cases, the library must be compiled with the QNX C/C++ (qcc) compiler matching the version included in the Simulink Real-Time Target Support Package. Shared objects must be copied to the filesystem in the target before being able to use them, whereas static libraries are directly added to the real-time application file on the host.
The following tutorial is a great resource to get started:
In R2020a and earlier, Simulink Real-Time uses the Win32 API compatible 32-bit RTOS. Only static libraries (.lib) are supported. in order to compile static libraries to link against your S-Function and run it on your Speedgoat target, they must be compiled as 32-bit libraries using Visual Studio. Please note that dynamic libraries (.dll) are not supported.
Once you have both 32-bit (for target) and 64-bit (for host) versions of your libraries, you can use the rtwmakecfg.m method to add the libraries to the build process:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!