Definitely, and that applies whether you are using Fortran 77 or Fortran 90. The trick here is using a two-part gateway function. The first gateway function receives nrhs, prhs, nlhs, and plhs as arguments. It determines which subroutine to call based upon the values of nrhs and nlhs. To this subroutine are also passed nrhs, prhs, nlhs, and plhs, and the MEX function proceeds normally. There is an example of such a function with a two-part gateway here.