How to create a .tlc wrapper file to inline s functions - question on tutorial

조회 수: 2 (최근 30일)
Aubrey
Aubrey 2024년 8월 30일
답변: Sahas 2024년 9월 4일
I am primarily looking for information on how to generate the .TLC file as described here. https://www.mathworks.com/help/rtw/tlc/wrapping-user-code-with-tlc.html
Referencing tutorial found here
C:\Software\Mathworks\Matlab_All_Products_2017b\toolbox\rtw\rtwdemos\tlctutorial\wrapper
I have an sfunction (X) with files X.c, X.h, X.mex. These were created using Simulink subsystem, right click, C, Generate S function.
In the example, there are two c files referenced, my_alg.c and wrapsfcn.c, no header. Is my S function X equivalent to wrapsfcn.c and wrapsfcn.mex, or do I need to copy my X.c to change_wrapsfcn.tlc as shown in the example?
Basically, is change_wrapsfcn.tlc a generic template where I need to add my C code from X.c to create the X.tlc? If not, where do I start for my .tlc file with X.c, X.h, and X.mex?

답변 (1개)

Sahas
Sahas 2024년 9월 4일
Hi @Aubrey,
As per my understanding, you would like to generate TLC files and wants to know if the TLC file mentioned in the example can be used as a template for this task.
The “change_wrapsfcn.tlc” file in the example can be considered as a template on guiding how to write wrapper functions for custom C-code. However, you will need to customize it to fit your specific S-function.
Follow the steps given below to make a custom TLC file:
  • Create a new file named “X.tlc” and duplicate the contents of the "change_wrapsfcn.tlc" file into it.
  • Modify the logic to call appropriate functions from the “X.c” file.
  • Ensure that the file includes the necessary logic to handle the inputs, outputs, and parameters with appropriate data types as defined in the S-function.
Refer to the following MathWorks documentation links for steps to write custom inline TLC files and understanding their syntax:
Hope this is beneficial!

카테고리

Help CenterFile Exchange에서 Target Language Compiler에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by