Skip to content

Commit 7a2c302

Browse files
author
ericwa
committed
libobjc2: tweaks to build on Windows
1 parent fe566cb commit 7a2c302

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ifeq ($(tdd), yes)
5252
libobjc_CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH
5353
endif
5454

55-
libobjc_LIBRARIES_DEPEND_UPON += -lpthread
55+
libobjc_LIBRARIES_DEPEND_UPON += -lpthread -ltoydispatch
5656

5757
# Deprecated functions are only deprecated for external use, not for us because
5858
# we are special, precious, little flowers.
@@ -62,7 +62,7 @@ libobjc_CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500
6262
# benefit from supporting platforms with no C99 compiler.
6363
libobjc_CFLAGS += -std=c99 -g -march=native -fexceptions -fno-inline
6464
libobjc_OBJCFLAGS += $(libobjc_CFLAGS)
65-
libobjc_LDFLAGS += -g -ltoydispatch
65+
libobjc_LDFLAGS += -g
6666
libobjc_LIB_DIRS += -L toydispatch/obj
6767

6868
libobjc_CFLAGS += -O3

legacy_malloc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ void *objc_atomic_malloc(size_t size)
1414
return malloc(size);
1515
}
1616

17+
#ifdef __MINGW32__
18+
void *objc_valloc(size_t size)
19+
{
20+
return malloc(size);
21+
}
22+
#else
1723
void *objc_valloc(size_t size)
1824
{
1925
return valloc(size);
2026
}
27+
#endif
2128

2229
void *objc_realloc(void *mem, size_t size)
2330
{

properties.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
#include <stdio.h>
33
#include <unistd.h>
44

5+
#ifdef __MINGW32__
6+
#include <windows.h>
7+
static unsigned sleep(unsigned seconds)
8+
{
9+
Sleep(seconds*1000);
10+
return 0;
11+
}
12+
#endif
13+
514
// Subset of NSObject interface needed for properties.
615
@interface NSObject {}
716
- (id)retain;

0 commit comments

Comments
 (0)