Centralized definitions of _WIN32_WINNT.

Removed malloc/calloc/realloc/free link-time overrides; we now
rely exclusively on compile-time overrides.

Made a few tweaks toward getting mingw-w64 working, but there
are still linker issues.
This commit is contained in:
Aaron Giles 2008-03-21 05:02:18 +00:00
parent 29a352ed4a
commit 04c0eba7b9
15 changed files with 43 additions and 31 deletions

View File

@ -7,9 +7,6 @@
//
//============================================================
// needed for multimonitor
#define _WIN32_WINNT 0x501
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -10,9 +10,6 @@
// For testing purposes: force DirectInput
#define FORCE_DIRECTINPUT 0
// Needed for RAW Input
#define _WIN32_WINNT 0x501
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -29,9 +29,6 @@
//
//============================================================
// Needed for RAW Input
#define _WIN32_WINNT 0x501
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0400
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>

View File

@ -7,9 +7,6 @@
//
//============================================================
// needed for multimonitor
#define _WIN32_WINNT 0x501
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -7,8 +7,6 @@
//
//============================================================
#define _WIN32_WINNT 0x0400
// standard windows headers
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@ -28,6 +26,8 @@
// CONSTANTS
//============================================================
#define OVERRIDE_STANDARD_CALLS (0)
#define PAGE_SIZE 4096
#define COOKIE_VAL 0x11335577
@ -193,10 +193,12 @@ void *malloc_file_line(size_t size, const char *file, int line)
// malloc - override for the malloc() function
//============================================================
#if OVERRIDE_STANDARD_CALLS
void *CLIB_DECL malloc(size_t size)
{
return malloc_file_line(size, NULL, 0);
}
#endif
//============================================================
@ -221,10 +223,12 @@ void *calloc_file_line(size_t size, size_t count, const char *file, int line)
// calloc - override for the calloc() function
//============================================================
#if OVERRIDE_STANDARD_CALLS
void *CLIB_DECL calloc(size_t size, size_t count)
{
return calloc_file_line(size, count, NULL, 0);
}
#endif
//============================================================
@ -232,10 +236,12 @@ void *CLIB_DECL calloc(size_t size, size_t count)
// which is called by beginthreadex
//============================================================
#if OVERRIDE_STANDARD_CALLS
void *CLIB_DECL _calloc_crt(size_t size, size_t count)
{
return calloc_file_line(size, count, NULL, 0);
}
#endif
//============================================================
@ -298,17 +304,20 @@ void *realloc_file_line(void *memory, size_t size, const char *file, int line)
// realloc - override for the realloc() function
//============================================================
#if OVERRIDE_STANDARD_CALLS
void *CLIB_DECL realloc(void *memory, size_t size)
{
return realloc_file_line(memory, size, NULL, 0);
}
#endif
//============================================================
// free - override for the free() function
// free_file_line - debugging version of free which
// accepts filename and line number
//============================================================
void CLIB_DECL free(void *memory)
void CLIB_DECL free_file_line(void *memory, const char *file, int line)
{
memory_entry *entry;
@ -346,11 +355,24 @@ void CLIB_DECL free(void *memory)
}
//============================================================
// free - override for the free() function
//============================================================
#if OVERRIDE_STANDARD_CALLS
void CLIB_DECL free(void *memory)
{
free_file_line(memory, NULL, 0);
}
#endif
//============================================================
// _msize - internal MSVC routine that returns the size of
// a memory block
//============================================================
#if OVERRIDE_STANDARD_CALLS
size_t CLIB_DECL _msize(void *memory)
{
size_t result;
@ -376,6 +398,7 @@ size_t CLIB_DECL _msize(void *memory)
}
return result;
}
#endif
//============================================================

View File

@ -11,7 +11,6 @@
#define LOG_TEMP_PAUSE 0
// Needed for RAW Input
#define _WIN32_WINNT 0x501
#define WM_INPUT 0x00FF
// standard windows headers

View File

@ -71,7 +71,7 @@ OBJDIRS += $(WINOBJ)
RC = @windres --use-temp-file
RCDEFS = -DNDEBUG -D_WIN32_IE=0x0400
RCDEFS = -DNDEBUG -D_WIN32_IE=0x0501
RCFLAGS = -O coff -I $(WINSRC) -I $(WINOBJ)
@ -198,7 +198,11 @@ endif
LIBS += -luser32 -lgdi32 -lddraw -ldsound -ldinput -ldxguid -lwinmm -ladvapi32 -lcomctl32 -lshlwapi
ifdef PTR64
ifdef MSVC_BUILD
LIBS += -lbufferoverflowu
else
DEFS += -D_COM_interface=struct
endif
endif

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0501
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0400
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>

View File

@ -7,13 +7,16 @@
//
//============================================================
#define _WIN32_WINNT 0x0501
#ifdef MALLOC_DEBUG
#include <stdlib.h>
// override malloc to track file/line
void* malloc_file_line(size_t size, const char *file, int line);
void* calloc_file_line(size_t size, size_t count, const char *FILE, int line);
void * realloc_file_line(void *memory, size_t size, const char *file, int line);
// override malloc/calloc/realloc/free to track file/line
void *malloc_file_line(size_t size, const char *file, int line);
void *calloc_file_line(size_t size, size_t count, const char *FILE, int line);
void *realloc_file_line(void *memory, size_t size, const char *file, int line);
void free_file_line(void *memory, const char *file, int line);
#undef malloc
#define malloc(x) malloc_file_line(x, __FILE__, __LINE__)
@ -21,6 +24,8 @@ void * realloc_file_line(void *memory, size_t size, const char *file, int line);
#define calloc(x,y) calloc_file_line(x, y, __FILE__, __LINE__)
#undef realloc
#define realloc(x,y) realloc_file_line(x, y, __FILE__, __LINE__)
#undef free
#define free(x) free_file_line(x, __FILE__, __LINE__)
#endif
#ifdef _MSC_VER
@ -32,7 +37,9 @@ void *__cdecl _alloca(size_t);
#endif
#ifdef __GNUC__
#ifndef alloca
#define alloca __builtin_alloca
#endif
#endif
#define PATH_SEPARATOR "\\"

View File

@ -8,9 +8,6 @@
//============================================================
// standard windows headers
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0400
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0400
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View File

@ -8,7 +8,6 @@
//============================================================
// standard windows headers
#define _WIN32_WINNT 0x0400
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>