libsdl-org / SDL-1.2

Simple Directmedia Layer, 1.2 branch ... ***DEPRECATED***, please use https://github.com/libsdl-org/SDL for new projects!
https://libsdl.org
GNU Lesser General Public License v2.1
104 stars 85 forks source link

[WINCE] Fix build with Embedded Visual Studio. #846

Closed carlo-bramini closed 3 years ago

carlo-bramini commented 3 years ago

These are few fixes that I made when building with Embedded Visual Studio for Windows CE and PocketPC SDK 2003. The library has been tested with the MS Emulator and on a PocketPC Asus A620.

sezero commented 3 years ago

Thanks.

sezero commented 5 months ago

@carlo-bramini: Would the following strdup patch still work for wince?

diff --git a/include/SDL_config_win32.h b/include/SDL_config_win32.h
index 93cf61f..6d2ae2d 100644
--- a/include/SDL_config_win32.h
+++ b/include/SDL_config_win32.h
@@ -131,12 +131,6 @@ typedef unsigned int uintptr_t;
 #define HAVE_STDDEF_H  1
 #endif

-/* Windows CE can support only _strdup() */
-#if defined(_WIN32_WCE) && defined(HAVE_STRDUP)
-#undef strdup
-#define strdup _strdup
-#endif
-
 /* Enable various audio drivers */
 #ifndef _WIN32_WCE
 #define SDL_AUDIO_DRIVER_DSOUND    1
diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index 48af720..e8e542f 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -409,7 +409,9 @@ extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t ma
 extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
 #endif

-#ifdef HAVE_STRDUP
+#if defined(HAVE_STRDUP) && defined(_WIN32)
+#define SDL_strdup    _strdup
+#elif defined(HAVE_STRDUP)
 #define SDL_strdup     strdup
 #else
 extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
carlo-bramini commented 5 months ago

At first sight, it seems to be the same thing but I have not Embedded Visual Studio installed for testing, at the moment.

sezero commented 5 months ago

OK, I pushed the patch as be74a7a89a5b004a03a04e3c4279d9068f88cfcd

Your original change was in SDL_config_win32.h, i.e. wince uses it, i.e. it is identified as _WIN32, therefore must work.

If you ever hit any issues, please drop a note. Thanks.