MATLAB: How to pass arguments to mclRunMain (argc and argv) while using a MATLAB generated C++ shared library

MATLAB Compiler

Is there any example which shows how to pass and accept command line arguments in "mclRunMain" while using MATLAB generated C++ shared library?

Best Answer

It is possible to pass command line arguments to "mclRunMain" while integrating a MATLAB generated C++ shared library. Please find an attached example which includes an implemented simple string concatenation function which accept 2 strings from the command line and prints the concatenated string. I have used the following MATLAB code to create shared library:
 
function out = concatString(input1,input2)
out = strcat(input1,input2);
end
Refer to the attached C++ code to see how to integrate this shared library.
Also, refer to the following link to see how to integrate the C++ shared library in your code: <https://www.mathworks.com/help/compiler_sdk/cxx/integrate-a-cc-shared-library-into-an-application.html>