| Summary: | [patch] add calling convention specifier SDLCALL for callback functions | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Marc Peter <macpete> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | macpete |
| Version: | HG 1.2 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
| Bug Depends on: | |||
| Bug Blocks: | 216 | ||
| Attachments: |
proposed patch for fixing calling convention of functions used as callbacks
fix 'testgl: OpenGL error: 1280' error given by testgl.exe |
||
|
Description
Marc Peter
2006-05-06 16:28:20 UTC
Created attachment 111 [details]
proposed patch for fixing calling convention of functions used as callbacks
This patch fixes the calling convention mismatch errors reported by the Open Watcom compiler, as the file name 'sdl-watcom.patch' suggests.
It is needed to build SDL and the tests for Win32 as either a static or dynamic link library on Win32 in Debug as well as in Release mode. The Watcom-Win32 makefile will be delivered separately.
I forgot to mention that this patch also contains the following fixes:
- update include/SDL_config_win32.h with #defines ala HAVE_STRLCPY for
OpenWatcom
- include <malloc.h> for alloca()
- fix test/testlock.c to not call raise() in the SIGINT handler
(Calling any C runtime function except abort(), _Exit() and signal()
in a signal handler exercises undefined behavior - this rules out raise().)
- change src/main/win32/SDL_win32_main.c:
+ remove __cdecl specifier from cleanup_output() because it is passed to
atexit() and therefore needs to have the compiler's default calling
convention
+ add SDL_Quit_Wrapper() to be used with atexit() instead of SDL_Quit() for
the same reason
Created attachment 112 [details]
fix 'testgl: OpenGL error: 1280' error given by testgl.exe
I had missed one calling convention specifier in src/video/wincommon/SDL_wingl.c
in the first patch.
Functions from opengl32.dll are exported using the WINAPI calling convention.
I added your patch to subversion, minus the changes to SDL_config_win32.h. SDL is designed to be built with only MSVCRT.DLL dependencies, to minimize the external C runtime dependencies. |