MATLAB Answers

Generate static library (.lib) to redistribute S-Function for code generation

3 views (last 30 days)
Sebastian on 27 Oct 2020
Commented: Pavani Majety on 4 Nov 2020
Hi everybody,
I get from a 3rd Party an S-Function which I integrate in my Simulink model, from which I need to generate code. Because of intellectual property issues, they understandably don't deliver any source Code.
This 3rd party supplies the .mex64 for cosimulation, dummy .c and .h files with no content, and a static library (.lib) file.
In the Code Generation options, under "Custom Code/Libraries" I can set the name of the provided .lib file, and with that I'm able to generate code from my Model which includes the S-Function.
So I know that this .lib file alone should contain in any way the encripted source code. Up to here, alright.
My problem appears now when I reverse the problem: I have to provide the s-Function for code generation in another Simulink model.
How do I generate that static library from a function of my self that I need to redistribute whitout the source code ??
I've generated the s-function by using the rtwsfcn.tlc file. It does create a .lib file, but I'm still not able to compile a test Simulink model which uses the s-Function. Simulink coder asks instead for the buildInfo.mat file.
Where is the trick ? How do I need to generate the S-Function ?
I will appreciate any help ;-)

  1 Comment

Pavani Majety
Pavani Majety on 4 Nov 2020
Can you provide more information on the buildInfo.mat error? You can try using S-Function builder to import your generated S-Function into the test model. Additionally try using the Legacy code tool, to generate the S-Function instead of rtwsfcn.tlc file. This will generate all the necessary files that your S-Function would need to import later. Let me know if that works!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!