MATLAB: Can I call an external shared library (DLL) from a MATLAB MEX-file

dlldynamicexternallibrarylinkMATLABmexmex fileobjectshared

I would like to call an external shared library (DLL) from a MATLAB MEX-file.

Best Answer

To link an external DLL to a MEX-file, list the DLL's .lib file on the command line.
Here is an example:
mex filename.c libname.lib
Note that when calling the MEX-file from MATLAB, the DLL should be in the same directory as the MEX-file.