what is difference between C static library and executables generated from matlab code using matlab coder?

조회 수: 11 (최근 30일)
during code generation there is an option saying you want to generate C/C++ static libraries or executables?
i want to know the difference between them and which of them is suitable choice for code deployment on c6713?
how to write main function and is it required in both static library and executables?
thank you.

답변 (1개)

Ryan Livingston
Ryan Livingston 2014년 4월 2일
You would likely want to generate a static library if you intend to utilize your generated code as a piece of a larger application on your C6713. In this case, you would likely be writing some other C code by hand or already have some code which will be run on the hardware and want to leverage your MATLAB code in that larger application. A static library does not require a main function. You would rather link it with your other code and call the generated functions from that code.
An executable is just that, a complete executable which can be run on its own. You would likely want to use this if you have the entirety of your application written in MATLAB and want to run the whole thing on your hardware. Creating an executable requires writing and supplying a main function as that main function is how the operating system knows to run the executable.
  댓글 수: 2
Kushant
Kushant 2014년 4월 3일
thank you for yor help...
where can i find guidlines of how to write main function?
Ryan Livingston
Ryan Livingston 2014년 4월 3일
Generally a main function is a function which has the signature:
int main (int argc, char *argv[])
where argc is the number of command-line arguments and argv is an array of strings representing those arguments.
Inside that main function, you would call the functions generated by MATLAB Coder. Examples of writing such a main and providing it to MATLAB Coder are available at:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Build Configuration에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by