S-function and Custom C Code support with Simulink Desktop Real-Time (SLDRT) in Kernel Mode
이전 댓글 표시
I have written a C-MEX S-function, or other custom C code that uses Windows API functions. When I try to compile this model using sldrt.tlc to run the real-time simulation with Simulink Desktop Real-Time (SLDRT) in Kernel Mode (previously called External Mode), I receive the following build error using MATLAB R2020a:
In file included from ...\someSource.c:134:
C:/PROGRA~1/MATLAB/R2020a/toolbox/sldrt/lib/include\Windows.h:16:2: error:
Attempt to include "windows.h"
C:/PROGRA~1/MATLAB/R2020a/toolbox/sldrt/lib/include\Windows.h:17:2: error:
The model being compiled contains a block that can run on host only and
cannot be compiled for External Mode. Please either switch to Normal Mode
or remove the block.
In newer versions of MATLAB:
In file included from someSourcec:21:
In file included from ./someSource.h:25:
C:/PROGRA~1/MATLAB/R2024b/toolbox/sldrt/lib/include\windows.h:16:2: error:
The model contains a block that requires to include the "windows.h" header
in its generated code. Such blocks cannot be compiled for Run in Kernel Mode.
Please either switch to Connected IO Mode or remove the block.
When I include an S-Function or other custom external C code in my model, is there a limitation regarding the C library functions it can use with Simulink Desktop Real-Time simulation in External Mode?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Model Preparation for Real-Time Simulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!