The libSDL authors provide an x86_64 DLL and import library on their download page. The .zip (also containing 32-bit versions) can be found at http://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip
I can build x64 executables with Visual Studio 2010 using the .lib and .dll they provide, and they work properly. However doing the same with mingw-w64 creates a non-working executable: it crashes at the first call in the DLL because the address generated at link time doesn't match the address of the function in the DLL.
However, rebuilding libSDL using mingw-64 and using the resulting .lib (still with the .dll provided by the SDL team) results in properly working executables.
I am attaching a tarball with the following elements:
- the upstream SDL.dll
- the upstream SDL.lib
- the SDL.lib I built with mingw-w64
- a tiny C++ program that calls SDL_getenv() then returns immediately
- a Makefile to build the above
test case
SDL, x86 libs
SDL, x64 libs
To clarify one thing: you don't generate an SDL.lib using mingw-w64, you create a ligbSDL.dll.a instead.
That out of the way, linkage using an MSVC x64 *.lib import library with binutils (mingw-w64) is not supported: you must use libSDL.dll.a generated by mingw-w64 toolchains. This is an x64 limitation in binutils and not a mingw-w64 bug.
For your convenience, I attached the import libraries here that I use myself: the *.lib files are for MSVC and the *.a files are for mingw-w64 (and don't worry, *.lib and *.a can reside in the same directory peacefully, because binutils prefers *.dll.a over *.lib.)
(This is actually a FAQ. See, e.g.: http://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg05157.html\)
Closing as invalid.