the MEX-wrapper