modify to use MEX macro instead of ORIGDLL