Fix compiling with MinGW and TDM

MinGW lacks some definitions; TDM wants WINVER defined.

Assume a default `CC=cc` should really be `CC=gcc`.
This commit is contained in:
Jason Hood 2017-11-21 11:46:58 +10:00
parent 826b0b66ba
commit a4125753a4
4 changed files with 41 additions and 5 deletions

1
ANSI.c
View File

@ -166,7 +166,6 @@
#include "ansicon.h"
#include "version.h"
#include <tlhelp32.h>
#include <mmsystem.h>
#ifndef SND_SENTRY

View File

@ -94,7 +94,6 @@
#include "ansicon.h"
#include "version.h"
#include <tlhelp32.h>
#include <ctype.h>
#include <fcntl.h>
#include <io.h>

View File

@ -17,7 +17,9 @@
#else
#define _WIN32_WINNT 0x0500 // at least Windows 2000 required
#endif
#define WINVER _WIN32_WINNT
#include <windows.h>
#include <tlhelp32.h>
#include <stdio.h>
#include <stdlib.h>
@ -27,6 +29,37 @@
#ifndef LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE
#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE 0x20
#endif
#ifndef TH32CS_SNAPMODULE32
#define TH32CS_SNAPMODULE32 0x10
#endif
#if !defined(HandleToULong) && !defined(_WIN64)
#define HandleToULong HandleToUlong
#endif
#ifndef __IMAGE_COR20_HEADER_DEFINED__
#define COMIMAGE_FLAGS_ILONLY 1
#define COMIMAGE_FLAGS_32BITREQUIRED 2
// CLR 2.0 header structure.
typedef struct IMAGE_COR20_HEADER
{
DWORD cb;
WORD MajorRuntimeVersion;
WORD MinorRuntimeVersion;
IMAGE_DATA_DIRECTORY MetaData;
DWORD Flags;
union {
DWORD EntryPointToken;
DWORD EntryPointRVA;
} DUMMYUNIONNAME;
IMAGE_DATA_DIRECTORY Resources;
IMAGE_DATA_DIRECTORY StrongNameSignature;
IMAGE_DATA_DIRECTORY CodeManagerTable;
IMAGE_DATA_DIRECTORY VTableFixups;
IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
IMAGE_DATA_DIRECTORY ManagedNativeHeader;
} IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
#endif
#define lenof(array) (sizeof(array)/sizeof(*(array)))
#define TSIZE(size) ((size) * sizeof(TCHAR))

View File

@ -21,6 +21,11 @@
# * MinGW-builds x64-4.8.1-release-posix-seh-rev1.
CC ?= gcc
ifeq ($(origin CC),default)
ifeq ($(CC),cc)
CC = gcc
endif
endif
WINDRES ?= windres
CFLAGS = -O2 -Wall -Wno-multichar
@ -101,7 +106,7 @@ x86/ansicon.exe: x86/ansicon.o $(X86OBJS) x86/procrva.o x86/ansiconv.o
$(LDmsg)$(CC) -m32 $+ -s -o $@ $(IVER)
x86/ANSI32.dll: x86/ANSI.o $(X86OBJS) x86/ansiv.o
$(LDmsg)$(CC) -m32 $+ -s -o $@ -mdll -Wl,-shared,--image-base,0xAC0000
$(LDmsg)$(CC) -m32 $+ -lwinmm -s -o $@ -mdll -Wl,-shared,--image-base,0xAC0000
x64:
mkdir x64
@ -110,10 +115,10 @@ x64/ansicon.exe: x64/ansicon.o $(X64OBJS) x64/ansiconv.o
$(LDmsg)$(CC) -m64 $+ -s -o $@ $(IVER)
x64/ANSI64.dll: x64/ANSI.o $(X64OBJS) x64/ansiv.o
$(LDmsg)$(CC) -m64 $+ -s -o $@ -mdll -Wl,-shared,--image-base,0xAC000000
$(LDmsg)$(CC) -m64 $+ -lwinmm -s -o $@ -mdll -Wl,-shared,--image-base,0xAC000000
x64/ANSI32.dll: x64/ANSI32.o x64/proctype32.o x86/injdll.o x86/util.o x86/ansiv.o
$(LDmsg)$(CC) -m32 $+ -s -o $@ -mdll \
$(LDmsg)$(CC) -m32 $+ -lwinmm -s -o $@ -mdll \
-Wl,-shared,--image-base,0xAC0000,--large-address-aware
x86/ansicon.o: version.h