What do I need to include when I use a static C library from Coder?

4 views (last 30 days)
I'm trying to learn how to use Coder. I have a simple Matlab function that I have converted into a static C library. I want to use this library on another machine as part of a larger program. What exactly do I need to move? Do I need the whole folder, including the examples and interface sub-folders?
This second machine will know nothing about Matlab, it runs only C.
What do the _initialize and _terminate functions do? Are they needed in a C environment?

Accepted Answer

Ryan Livingston
Ryan Livingston on 1 Aug 2015
Edited: Ryan Livingston on 1 Aug 2015
The MATLAB Coder documentation has a deployment section with many relevant topics that discuss this. Some particular pages of note would be:
  • Calling the generated functions - Describes the interface for the code and the initialize and terminate functions. Those functions set up some necessary data structures and any persistent or global data. Call initialize once before using your other generated code and call terminate once at the end.
  • Package generated code - Describes how to package the code and any necessary dependencies to move to another environment.
  • Using and example main - The examples folder contains an example of a C main function that can call your generated code. It shows how to interact with the generated code and can be a good starting place for using the code. The example main also shows the proper usage the initialize and terminate functions.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!