You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.0 Reported for operating system, platform: Windows (All), x86
Comments on the original bug report:
On 2013-09-05 10:25:56 +0000, wrote:
On Windows, if SDL is compiled targeting x86 and without a C runtime library the SDL_stlib.c defines a _chkstk symbol, but there are no actual instructions for this function.
This is not a problem if SDL is compiled as a dynamic library as it doesn't seem to generate any _chkstk calls. However, people want to link it statically now and their code might generate those calls which will cause the application to terminate pretty fast.
I would recommend everyone to compile SDL 2.0.0 with HAVE_LIBC defined and the Visual C++ runtime library when using MSVC and linking SDL statically on Windows x86.
Writing an actual implementation probably requires some knowledge about the Microsoft implementation. Copying theirs obviously has licensing issues.
Here's the disassembly that shows the issue in code form.
--- src\stdlib\sdl_stdlib.c -----------------------
SDL_toupper:
mov eax,dword ptr [esp+4]
lea ecx,[eax-61h]
cmp ecx,19h
ja SDL_toupper+0Fh (0CC15DFh)
add eax,0FFFFFFE0h
ret
SDL_tolower:
mov eax,dword ptr [esp+4]
lea ecx,[eax-41h]
cmp ecx,19h
ja SDL_tolower+0Fh (0CC15EFh)
add eax,20h
ret
_chkstk:
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
int 3
_ftol:
push ebp
mov ebp,esp
sub esp,20h
and esp,0FFFFFFF0h
fld st(0)
fst dword ptr [esp+18h]
fistp qword ptr [esp+10h]
On 2013-09-23 18:30:53 +0000, CD-i Fan wrote:
If you define HAVE_LIBC, SDL_stdlib.c will not define a _chkstk symbol.
On 2013-09-28 06:12:38 +0000, Sam Lantinga wrote:
Yes, if you compile it as a static library, you should compile with HAVE_LIBC defined.
Thanks!
On 2013-09-28 07:34:07 +0000, wrote:
And for the case where SDL is a DLL and has no VC++ runtime library? Are the SDL developers just going to be very careful to write code that never emits _chkstk calls? I guess it works with the current version. I'm just worried that this is going to be really annoying for someone in the future.
The text was updated successfully, but these errors were encountered:
This bug report was migrated from our old Bugzilla tracker.
Reported in version: 2.0.0
Reported for operating system, platform: Windows (All), x86
Comments on the original bug report:
On 2013-09-05 10:25:56 +0000, wrote:
On 2013-09-23 18:30:53 +0000, CD-i Fan wrote:
On 2013-09-28 06:12:38 +0000, Sam Lantinga wrote:
On 2013-09-28 07:34:07 +0000, wrote:
The text was updated successfully, but these errors were encountered: