Question

I'm trying to use an existing compiled C library (.dll on Windows x64) with Simulink. I've written a basic library along with the necessary level-2 S-functions (.m files) and code generation translation files (.tlc). My code works fine in simulation, and code generation executes without errors, though none of my custom code specified in the .tlc files ends up in the output. If there is a syntax error in any of my .tlc files, however, code generation fails, so it's at least parsing the files. Referencing example code for code generation has not revealed anything that I appear to be missing.

Considering the number of files and amount of code here, I've put everything in a Github repository. If you're on Windows running x64 MATLAB 2011b or newer, you should be able to run everything out of the gate. The final output in TestLibTest_grt_rtw/TestLibTest.c:TestLibTest_output() should contain two calls to TestLibGet(), as specified by TestLibGet.tlc.

Was it helpful?

Solution

I think you meant "Get()" is not called from the generated code. Your tlc file does not have correct line endings in the github repository you linked. Once you fix that, the call to Get() appears in the generated code. Fixing this could be specific to platform. If you open tlc file in a simple code editor in your platform you should be able to see new lines at correct locations. If you see characters like ^M you need to replace it with new line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top