comparison include/SDL_stdlib.h @ 1330:450721ad5436

It's now possible to build SDL without any C runtime at all on Windows, using Visual C++ 2005
author Sam Lantinga <slouken@libsdl.org>
date Mon, 06 Feb 2006 08:28:51 +0000
parents
children 3692456e7b0f
comparison
equal deleted inserted replaced
1329:bc67bbf87818 1330:450721ad5436
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22
23 #ifndef _SDL_stdlib_h
24 #define _SDL_stdlib_h
25
26 #include "SDL_config.h"
27
28 /* AIX requires this to be the first thing in the file. */
29 #ifndef __GNUC__
30 # if HAVE_ALLOCA_H
31 # include <alloca.h>
32 # else
33 # ifdef _AIX
34 #pragma alloca
35 # else
36 # ifndef alloca /* predefined by HP cc +Olibcalls */
37 char *alloca ();
38 # endif
39 # endif
40 # endif
41 #endif
42
43 #ifdef HAVE_STDLIB_H
44 #include <stdlib.h>
45 #endif
46
47 #ifdef HAVE_MALLOC_H
48 #include <malloc.h>
49 #endif
50
51 #include "SDL_types.h"
52 #include "SDL_stdarg.h"
53 #include "SDL_getenv.h"
54
55
56 #include "begin_code.h"
57 /* Set up for C function definitions, even when using C++ */
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 #ifdef HAVE_MALLOC
63 #define SDL_malloc malloc
64 #else
65 #define malloc SDL_malloc
66 extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
67 #endif
68
69 #ifdef HAVE_REALLOC
70 #define SDL_realloc realloc
71 #else
72 #define realloc SDL_realloc
73 extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
74 #endif
75
76 #ifdef HAVE_FREE
77 #define SDL_free free
78 #else
79 #define free SDL_free
80 extern DECLSPEC void SDLCALL SDL_free(void *mem);
81 #endif
82
83 #ifdef HAVE_ALLOCA
84 #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
85 #define SDL_stack_free(data)
86 #else
87 #define SDL_stack_alloc(type, count) SDL_malloc(sizeof(type)*count)
88 #define SDL_stack_free(data) SDL_free(data)
89 #endif
90
91 #ifdef HAVE_QSORT
92 #define SDL_qsort qsort
93 #else
94 #define qsort SDL_qsort
95 extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
96 int (*compare)(const void *, const void *));
97 #endif
98
99 /* Ends C function definitions when using C++ */
100 #ifdef __cplusplus
101 }
102 #endif
103 #include "close_code.h"
104
105 #endif /* _SDL_stdlib_h */