How to manage c files generated from matlab coder?

2 views (last 30 days)
I have a library with multiple functions. I want to use matlab coder to help me write my c-files. These c-files are compiled and linked to generate my library using VS 2015. So I test this theory by converting funcA.m to funcA.c using matlab coder ver 3.4 (R2017b) . Then I compiled and linked all the c-files generated by matlab coder to include funcA inside my library. And this worked perfectly. The problem arises when I use matlab coder to generate my second function. Let's call the second function -> funcB
After converting funcA.m to funcA.c, matlab coder had generated other c-files which includes xgeqp3.c and xnmr2.c. These matlab generated c-file caused me problems because when I converted funcB.m to funcB.c, it had also generated xgeqp3.c and xnmr2.c. Although the files names are identical, its contents are different, with different formal parameters and of course different c-codes, even though they have the same function name and file name.
So my library cannot contain these two functions generated by matlab coder because the declarations for xgeqp3.c and xnmr2.c contradicts. I'm sure other people might have the same problem. Is there a way I can manually name the extra c-files generated my matlab coder so that I can avoid such duplicate names? Or is there a way I can manage the c-files with duplicate names but different codes?
Please help. Thank you in advance.
  2 Comments
Ji Lee
Ji Lee on 1 Oct 2018
A robust method to let MATLAB Coder take care of this is by specifying multiple entry-point functions as part of a single MATLAB Coder workflow. This is in contrast to generating code for each top-level function independently in a manner where MATLAB Coder is unaware of the other functions.
codegen funcA -args myTypesA funcB -args myTypesB
Similarly, in the MATLAB Coder app, the same thing can be achieved from the "Select" step by repeatedly using the "add entry-point function" button.
Ummi Hani
Ummi Hani on 8 Oct 2018
Now, i'm having trouble in auto defining unbounded array inputs. Do you know how to auto define unbounded array inputs? Auto define would be useful when other people want to make additions to my project. For example, a second person wants to add funcC but has to be able to reproduce the same initial funcA.c and funcB.c .

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!