Enabled libc support on Win32, so we don't break binary compatibility in 1.2
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401475
This commit is contained in:
parent
0917598732
commit
8039553413
7 changed files with 88 additions and 8 deletions
BIN
VisualC.zip
BIN
VisualC.zip
Binary file not shown.
BIN
VisualCE.zip
BIN
VisualCE.zip
Binary file not shown.
|
@ -51,14 +51,64 @@ typedef signed int int32_t;
|
||||||
typedef unsigned int uint32_t;
|
typedef unsigned int uint32_t;
|
||||||
typedef signed long long int64_t;
|
typedef signed long long int64_t;
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
|
#ifndef _SIZE_T_DEFINED_
|
||||||
|
#define _SIZE_T_DEFINED_
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
|
#endif
|
||||||
typedef unsigned int uintptr_t;
|
typedef unsigned int uintptr_t;
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
#define SDL_HAS_64BIT_TYPE 1
|
#define SDL_HAS_64BIT_TYPE 1
|
||||||
|
|
||||||
|
/* Enabled for SDL 1.2 (binary compatibility) */
|
||||||
|
#define HAVE_LIBC 0
|
||||||
|
#if HAVE_LIBC
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
|
#define HAVE_STDIO_H 1
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* C library functions */
|
||||||
|
#define HAVE_MALLOC 1
|
||||||
|
#define HAVE_CALLOC 1
|
||||||
|
#define HAVE_REALLOC 1
|
||||||
|
#define HAVE_FREE 1
|
||||||
|
#define HAVE_ALLOCA 1
|
||||||
|
#define HAVE_QSORT 1
|
||||||
|
#define HAVE_ABS 1
|
||||||
|
#define HAVE_MEMSET 1
|
||||||
|
#define HAVE_MEMCPY 1
|
||||||
|
#define HAVE_MEMMOVE 1
|
||||||
|
#define HAVE_MEMCMP 1
|
||||||
|
#define HAVE_STRLEN 1
|
||||||
|
#define HAVE__STRREV 1
|
||||||
|
#define HAVE__STRUPR 1
|
||||||
|
#define HAVE__STRLWR 1
|
||||||
|
#define HAVE_STRCHR 1
|
||||||
|
#define HAVE_STRRCHR 1
|
||||||
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_ITOA 1
|
||||||
|
#define HAVE__LTOA 1
|
||||||
|
#define HAVE__ULTOA 1
|
||||||
|
#define HAVE_STRTOL 1
|
||||||
|
#define HAVE_STRTOUL 1
|
||||||
|
#define HAVE_STRTOLL 1
|
||||||
|
#define HAVE_STRTOD 1
|
||||||
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
|
#define HAVE_STRCMP 1
|
||||||
|
#define HAVE_STRNCMP 1
|
||||||
|
#define HAVE_STRICMP 1
|
||||||
|
#define HAVE_STRCASECMP 1
|
||||||
|
#define HAVE_SSCANF 1
|
||||||
|
#else
|
||||||
#define HAVE_STDARG_H 1
|
#define HAVE_STDARG_H 1
|
||||||
#define HAVE_STDDEF_H 1
|
#define HAVE_STDDEF_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct SDL_Thread;
|
||||||
typedef struct SDL_Thread SDL_Thread;
|
typedef struct SDL_Thread SDL_Thread;
|
||||||
|
|
||||||
/* Create a thread */
|
/* Create a thread */
|
||||||
#if defined(__WIN32__) || defined(__OS2__)
|
#if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)
|
||||||
/*
|
/*
|
||||||
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
|
||||||
creates a new thread for the calling process with the SDL_CreateThread()
|
creates a new thread for the calling process with the SDL_CreateThread()
|
||||||
|
@ -59,11 +59,9 @@ typedef struct SDL_Thread SDL_Thread;
|
||||||
So, in short:
|
So, in short:
|
||||||
Always use the _beginthread() and _endthread() of the calling runtime library!
|
Always use the _beginthread() and _endthread() of the calling runtime library!
|
||||||
*/
|
*/
|
||||||
|
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#include <process.h> // This has _beginthread() and _endthread() defined!
|
#include <process.h> /* This has _beginthread() and _endthread() defined! */
|
||||||
#endif
|
|
||||||
#ifdef __EMX__
|
|
||||||
#include <stdlib.h> // This has _beginthread() and _endthread() defined, if -Zmt flag is used!
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
saves a system-dependent thread id in thread->id, and returns 0
|
saves a system-dependent thread id in thread->id, and returns 0
|
||||||
on success.
|
on success.
|
||||||
*/
|
*/
|
||||||
#if defined(__WIN32__) || defined(__OS2__)
|
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
extern int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
extern int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
|
||||||
#else
|
#else
|
||||||
extern int SDL_SYS_CreateThread(SDL_Thread *thread, void *args);
|
extern int SDL_SYS_CreateThread(SDL_Thread *thread, void *args);
|
||||||
|
|
|
@ -209,7 +209,7 @@ void SDL_RunThread(void *data)
|
||||||
*statusloc = userfunc(userdata);
|
*statusloc = userfunc(userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WIN32__) || defined(__OS2__)
|
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
#undef SDL_CreateThread
|
#undef SDL_CreateThread
|
||||||
DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
|
DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
|
||||||
#else
|
#else
|
||||||
|
@ -250,7 +250,7 @@ DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data)
|
||||||
SDL_AddThread(thread);
|
SDL_AddThread(thread);
|
||||||
|
|
||||||
/* Create the thread and go! */
|
/* Create the thread and go! */
|
||||||
#if defined(__WIN32__) || defined(__OS2__)
|
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
|
ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
|
||||||
#else
|
#else
|
||||||
ret = SDL_SYS_CreateThread(thread, args);
|
ret = SDL_SYS_CreateThread(thread, args);
|
||||||
|
|
|
@ -30,6 +30,26 @@
|
||||||
#include "../SDL_thread_c.h"
|
#include "../SDL_thread_c.h"
|
||||||
#include "../SDL_systhread.h"
|
#include "../SDL_systhread.h"
|
||||||
|
|
||||||
|
#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
|
#ifndef _WIN32_WCE
|
||||||
|
/* We'll use the C library from this DLL */
|
||||||
|
#include <process.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
|
typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||||
|
unsigned (__stdcall *func)(void *), void *arg,
|
||||||
|
unsigned, unsigned *threadID);
|
||||||
|
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||||
|
#else
|
||||||
|
typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
|
||||||
|
unsigned (__stdcall *func)(void *), void *arg,
|
||||||
|
unsigned, unsigned *threadID);
|
||||||
|
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
|
||||||
|
#endif
|
||||||
|
#endif /* !SDL_PASSED_BEGINTHREAD_ENDTHREAD */
|
||||||
|
|
||||||
|
|
||||||
typedef struct ThreadStartParms
|
typedef struct ThreadStartParms
|
||||||
{
|
{
|
||||||
void *args;
|
void *args;
|
||||||
|
@ -56,8 +76,20 @@ static unsigned __stdcall RunThread(void *data)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
|
||||||
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
|
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
|
||||||
{
|
{
|
||||||
|
#else
|
||||||
|
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
pfnSDL_CurrentBeginThread pfnBeginThread = NULL;
|
||||||
|
pfnSDL_CurrentEndThread pfnEndThread = NULL;
|
||||||
|
#else
|
||||||
|
pfnSDL_CurrentBeginThread pfnBeginThread = _beginthreadex;
|
||||||
|
pfnSDL_CurrentEndThread pfnEndThread = _endthreadex;
|
||||||
|
#endif
|
||||||
|
#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
|
||||||
unsigned threadid;
|
unsigned threadid;
|
||||||
pThreadStartParms pThreadParms = (pThreadStartParms)SDL_malloc(sizeof(tThreadStartParms));
|
pThreadStartParms pThreadParms = (pThreadStartParms)SDL_malloc(sizeof(tThreadStartParms));
|
||||||
if (!pThreadParms) {
|
if (!pThreadParms) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue