@Andrey: Please see the following makefile below (I only provide the relevant portion). Needless to say, I source iccvars.sh (with argument intel64) as required in the documentation, so the declarations of CPATH and MKLROOT should be obvious.
SHELL = /bin/bash
MATHOME = /usr/local/matlab77
FC = ifort
FFLAGS = -O3 -xHost -openmp -warn -shared -fexceptions -fPIC \
-fno-omit-frame-pointer -DMX_COMPAT_32
INCL = -I${CPATH} -I${MATHOME}/extern/include
LIBS = -L${MKLROOT}/lib/em64t\
${INCL} -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread -lm
EXT = mexa64
OBJ = normrandintel.o # and lots of other stuff here...
mymatlabmexfile.${EXT}: ${OBJ}
${FC} ${FFLAGS} mymatlabmexfile.F90 ${OBJ} -o $@ ${LIBS}
normrandintel.o:
${FC} ${FFLAGS} -c normrandintel.F90 ${LIBS}
# lots of other dependencies here...
@Ying: Thanks for your clarifications, this is useful to know. Needless to say, when I do the nm command you give on my machine the symbol is listed. Please see above for the building/linking.
Finally, note that I have openmp in the FFLAGS since part of the code uses OpenMP directives. I also tried linking against libiomp5 but Matlab doesn't seem to like it. (I since reverted back to 11.0.84, I think at some point when using MKL 10.2 I also experimented with the additional flag to ifort "-openmp-lib legacy" without success.)