You can refer to the following documentation for linking "C" libraries during creation of "mex" files: http://www.mathworks.com/help/matlab/ref/mex.html#inputs
Also, creating a mex file from a C code and generating C code using MATLAB coder are two very different things. I doubt if the functionality of MATLAB Coder can be replicated by building mex files from C libraries. Mex files are built by creating a wrapper over your source code and allowing it to be used as executable on MATLAB platform. On the other hand MATLAB Coder generates the appropriated C code by evaluating each line of the source MATLAB code.
Hope this helps.