Implement a C Shared Library with a Driver Application
This example shows how to call a C shared library built with MATLAB® Compiler SDK™ from a C application.
Create the C shared library as specified in the example Create a C Shared Library with MATLAB Code.
matrix.cfile located in
matlabroot\extern\examples\compilersdk\c_cpp\matrixor your work folder.
Copy and paste this file in the folder that contains your C shared library. If you used the Library Compiler, it is located in the
At the system command prompt, navigate to the folder where you copied
mbuildto compile and link the application.
mbuild matrix.c libmatrix.lib
.libextension is for Windows®. On Mac, the file extension is
.dylib, and on UNIX® it is
From the system command prompt, run the application.
matrix The sum of the matrix with itself is: 2.00 8.00 14.00 4.00 10.00 16.00 6.00 12.00 18.00 The product of the matrix with itself is: 30.00 66.00 102.00 36.00 81.00 126.00 42.00 96.00 150.00 The eigenvalues of the original matrix are: 16.12 -1.12 -0.00