MATLAB: How to call matlab generated function from c program

generate c codehow to call the generated code?MATLABmatlab coder

Hi,
I am new to Matlab coder and would like to use generated functions in a project. I wrote few function implementations, say
objects = fuse_detections(frame_r, frame_c, ldr, ts)
in matlab and generated c code using Matlab coder. C code for the function implementations are generated successfully. I want to call the generated functions, by passing arguments and get values, from an other c program (which is a normal c program). I am aware that I should link generated object files (.o files) with the c program in order to use those functions. I did link .o files and .c files using ninja. How do I call those generated functions from my c program?

Best Answer

You have to include the appropriate header files which contains the generated function declaration. Then you can directly call those functions from your other C/C++ coder. While compiling the entire application, you need to link the library appropriately.
Below document explains how to use the generated dll in Visual Studio and how to call it in a new C/C++ coder :
You can also generate a sample example main file and take a look at it on how to use the generated functions :
Hope this will be helpful