README.cmake
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 6674 45a21e50ba5e
permissions -rw-r--r--
Fixed bug 1846 - _allmul implementation in SDL_stdlib.c doesn't clean up the stack

Colin Barrett

I see this manifest itself (VS2012 x86) as:

"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

in the first call to SDL_GetTicks in my application. The disassembly at the problem line is:

hires_now.QuadPart *= 1000;
00AD0792 push 0
00AD0794 push 3E8h
00AD0799 mov eax,dword ptr [ebp-10h]
00AD079C push eax
00AD079D mov ecx,dword ptr [hires_now]
00AD07A0 push ecx
00AD07A1 call _allmul (0AE7D40h)
00AD07A6 mov dword ptr [hires_now],eax
00AD07A9 mov dword ptr [ebp-10h],edx

Apparently _allmul should be popping the stack but isn't (other similar functions in SDL_stdlib.c - _alldiv and whatnot - DO pop the stack).

A 'ret 10h' at the end of _allmul appears to do the trick
gabomdq@6674
     1
================================================================================
gabomdq@6674
     2
CMake build system for SDL (www.cmake.org)
gabomdq@6674
     3
================================================================================
gabomdq@6674
     4
gabomdq@6674
     5
SDL's build system was traditionally based on autotools. Over time, this
gabomdq@6674
     6
approach has suffered from several issues across the different supported 
gabomdq@6674
     7
platforms.
gabomdq@6674
     8
To solve these problems, a new build system based on CMake is under development.
gabomdq@6674
     9
It works in parallel to the legacy system, so users can experiment with it
gabomdq@6674
    10
without complication.
gabomdq@6674
    11
While still experimental, the build system should be usable on the following
gabomdq@6674
    12
platforms:
gabomdq@6674
    13
    
gabomdq@6674
    14
    * FreeBSD
gabomdq@6674
    15
    * Linux
gabomdq@6674
    16
    * VS.NET 2010
gabomdq@6674
    17
    * MinGW and Msys
gabomdq@6674
    18
    * OS X with support for XCode
gabomdq@6674
    19
    
gabomdq@6674
    20
================================================================================
gabomdq@6674
    21
Usage
gabomdq@6674
    22
================================================================================
gabomdq@6674
    23
gabomdq@6674
    24
Assuming the source for SDL is located at ~/sdl
gabomdq@6674
    25
gabomdq@6674
    26
cd ~
gabomdq@6674
    27
mkdir build
gabomdq@6674
    28
cd build
gabomdq@6674
    29
cmake ../sdl
gabomdq@6674
    30
gabomdq@6674
    31
This will build the static and dynamic versions of SDL in the ~/build directory.