MATLAB: Mex file from C++

MATLAB C/C++ Math Librarymex compiler

I have demo C++ code. However, the main project was written in Matlab, and I want to add demo C++ code into Matlab creating .m file by calling mex. The .dll, and .h file is available in the folder, but the .dll is not compiled package. Is there any way to construct mex in that case?

Best Answer

In the situation you describe you are more likely to use loadlibrary to make the calls.
Using mex is possible but you would have to write the interface yourself: code to accept matlab data structure and extract the data and call into the dll and package the results back for MATLAB.