Windows code issues

Hello SDL,

I wanted to report some code issues with windows version of SDL (from hg sdl-1.2).

Basically, SDL doesn’t do proper UNICODE vs non-UNICODE build. On Windows, while most functions have xxxW and xxxA variants for ansi and wide char strings, there are some exceptions and SDL fails on these.

  1. GetProcAddress doesn’t have W and A variants on desktop windows, that is, it won’t compile for UNICODE this way:
    GetProcAddress(DSoundDLL, TEXT(“DirectSoundCaptureCreate”))
    Crorrected version:
    GetProcAddress(DSoundDLL, “DirectSoundCaptureCreate”)

SDL supports WinCE, and for some strange reason WinCE has only wide char version of GetProcAddress, that is to be portable with WinCE there should be #ifdef _WIN32_WCE or GetProcAddress should be redefined for WinCE and ansi version should be implemented inside sdl:

#include <Windows.h>
#ifdef _WIN32_WCE
FARPROC GetProcAddressA(HMODULE hModule, LPCSTR lpProcName);
#define GetProcAddress GetProcAddressA
#endif

  1. Define for DECLSPEC is pretty messy. There is a good write up on proper exportging symbols http://gcc.gnu.org/wiki/Visibility#line-36

  2. SDL tries to support WinCE as well. Instead, im post of the places it shold have been #ifdef _UNICODE instead of #ifdef _WIN32_WCE, because most these ifdefs aren’t WinCE specific, but are UNICODE specific which also possible on regular Win32.

Hope that helps to improve that simple stuff.