README.HG
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 5072 2341ecc03388
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
icculus@4421
     1
The latest development version of SDL is available via Mercurial.
icculus@4421
     2
Mercurial allows you to get up-to-the-minute fixes and enhancements;
icculus@4421
     3
as a developer works on a source tree, you can use "hg" to mirror that
icculus@1652
     4
source tree instead of waiting for an official release. Please look
icculus@4421
     5
at the Mercurial website ( http://mercurial.selenic.com/ ) for more
icculus@4421
     6
information on using hg, where you can also download software for
icculus@4421
     7
Mac OS X, Windows, and Unix systems.
icculus@1652
     8
icculus@4421
     9
  hg clone http://hg.libsdl.org/SDL
icculus@1652
    10
slouken@1759
    11
If you are building SDL with an IDE, you will need to copy the file
slouken@1759
    12
include/SDL_config.h.default to include/SDL_config.h before building.
icculus@1652
    13
slouken@1759
    14
If you are building SDL via configure, you will need to run autogen.sh
slouken@1759
    15
before running configure.
icculus@1652
    16
slouken@1759
    17
There is a web interface to the subversion repository at:
icculus@5072
    18
icculus@4421
    19
	http://hg.libsdl.org/SDL/
slouken@1759
    20
icculus@2708
    21
There is an RSS feed available at that URL, for those that want to
icculus@2708
    22
track commits in real time.
icculus@2708
    23