Can I call external binary code (DLL, LIB, EXE) during a Simulink Desktop Real-Time simulation?

10 vues (au cours des 30 derniers jours)
I have model containing an S-functions that calls into external binary code (DLL, LIB, EXE). I would like to run this simulation in real-time on my Windows PC using Simulink Desktop Real-Time (SLDRT) in External Mode. Is this possible?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 10 Mar 2022
Modifié(e) : MathWorks Support Team le 11 Mar 2022
It is not possible to call external binary code when using SLDRT in External Mode. This is a fundamental limitation that has to do with how SLDRT External Mode works.
The reason is that the code for a DLL, LIB or EXE is compiled for Windows, which is an environment completely different than the SLDRT kernel. This means that the Windows API is not available at all, memory allocation is done in a very different way, and calls to all these Windows functions are already compiled to the binary and this cannot be changed. As an example, let's take malloc() - although it looks the same in Windows source and in SLDRT source, it does very different things when compiled. Another way to look at the reasons - no-one would probably try to use a binary library compiled for Windows in Linux, although the source code of the library may be compilable for both.
Note that the same limitation does not apply for Normal or Accelerator Mode real-time simulations. To learn more about the different SLDRT simulation modes, see the following MATLAB Answers article:

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by