Compiling mex files on 64-windows has always been a huge pain. It used to require having a real copy of Visual Studio. A year or so ago, there was a platform sdk that finally included a 64-bit compiler.
Now, the mingw64 project is sufficiently advanced to let us compile mex files. This is all nicely packaged up in the cygwin repository too.
Don’t worry, the mingw compilers in the cygwin repository generate fully redistributable native windows code without any cygwin dependencies (a small caveat: I’m not sure about whether or not you need a libstdc++.dll file for g++ codes… comments?)
- Get setup.exe from cygwin
- Search for mingw and mark all the mingw modules for installation
- Search for mingw64 and mark all the mingw64 modules for installation (yes, this is way more than strictly necessary, but its the easiest way to go)
- Install those modules and all dependencies to the default location: C:\cygwin
- Using mingw64 compilers with gnumex. Is this still necessary? The above seems to work pretty nicely!
- Why doesn’t -static-libstdc++ work under the cygwin version of x86_64-w64-mingw32-gcc-4.5.3 ?
- How the heck can we get a single mexopts.bat file that’ll work with fortran codes too?
- Can we get matlab to include a default config file for this compiler setup and support it?
Special thanks to Oren Livne and the dynare team for helping to figure this stuff out! (The above mexopts.bat file is basically what they had with a few small changes that Oren and I discovered.)