make mex files compile with linux

Changes are compatible with the windows code using #ifdef WIN32