Template for Mex compilation