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

10 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 10 de Mzo. de 2022
Editada: MathWorks Support Team el 11 de Mzo. de 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:

Más respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by