INSTALL
author Sam Lantinga <slouken@libsdl.org>
Thu, 16 May 2013 00:43:22 -0700
changeset 7180 3733e68edbc3
parent 6878 30579e86ac24
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
slouken@0
     1
slouken@0
     2
To compile and install SDL:
slouken@0
     3
slouken@3561
     4
    0.  If you have downloaded this from the website, skip to the next step.
slouken@3561
     5
        If you have checked this out from subversion, you'll need to run
slouken@3561
     6
        ./autogen.sh to build the configure script. 
slouken@3561
     7
slouken@0
     8
    1.  Run './configure; make; make install'
slouken@0
     9
slouken@866
    10
        If you are compiling for Windows using gcc, read the FAQ at:
slouken@866
    11
        http://www.libsdl.org/faq.php?action=listentries&category=4#42
slouken@0
    12
slouken@0
    13
        If you are compiling using Visual C++ on Win32, you should read
slouken@0
    14
        the file VisualC.html
slouken@0
    15
slouken@6878
    16
    2.  Look at the example programs in ./test, and check out the online
slouken@6878
    17
        documentation at http://wiki.libsdl.org/
slouken@0
    18
slouken@0
    19
    3.  Join the SDL developer mailing list by sending E-mail to
slouken@253
    20
    	sdl-request@libsdl.org
slouken@253
    21
        and put "subscribe" in the subject of the message.
slouken@0
    22
slouken@253
    23
        Or alternatively you can use the web interface:
slouken@533
    24
            http://www.libsdl.org/mailing-list.php
slouken@0
    25
slouken@0
    26
That's it!
slouken@0
    27
Sam Lantinga <slouken@libsdl.org>