How to generate a TLC file for a MEX file externally obtained?
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a Simulink simulation utilizing an S-Function block tied to an externally generated MEX file, which I am trying to make code generation compatible.
I have reviewed these articles about the topic:
- Use Level-2 MATLAB S-function: https://www.mathworks.com/help/simulink/slref/level2matlabsfunction.html
- TLC Files: https://www.mathworks.com/help/rtw/tlc/tlc-files.html
However, I was wondering how I would generate a TLC file if the MEX was auto-generated by an external modeling software. Do I need access to the source C Code before MEX file generation? Is there a way to manually build it without knowledge of how the MEX is built?
Just looking for information on what information/access I would need.
Thanks!
0 个评论
回答(1 个)
Pratyush
2024-8-14
Hi Roop,
To generate a TLC file for an MEX file created by external modeling software, ideally, you should have access to the source C code. This allows you to understand the function signatures, data structures, and algorithms used, making it easier to write a TLC file that mirrors the MEX function's behavior.
If you don't have the source code, you need to understand the MEX function's interface, including input/output arguments and data types, and its behavior, possibly through documentation or testing. You should also understand the Simulink S-Function block's interaction with the MEX function.
Steps to Create a TLC File:
1. Document the Interface: Note input/output ports, data types, and parameters.
2. Write the TLC File: Mimic the MEX function's behavior in the TLC file, defining input/output ports.
3. Test the TLC File: Ensure the generated code behaves like the original MEX function by comparing results.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Target Language Compiler 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!