Skip to content

Commit

Permalink
libobjc2: tweaks to build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwa committed Sep 3, 2010
1 parent fe566cb commit 7a2c302
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ifeq ($(tdd), yes)
libobjc_CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH
endif

libobjc_LIBRARIES_DEPEND_UPON += -lpthread
libobjc_LIBRARIES_DEPEND_UPON += -lpthread -ltoydispatch

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

libobjc_CFLAGS += -O3
Expand Down
7 changes: 7 additions & 0 deletions legacy_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ void *objc_atomic_malloc(size_t size)
return malloc(size);
}

#ifdef __MINGW32__
void *objc_valloc(size_t size)
{
return malloc(size);
}
#else
void *objc_valloc(size_t size)
{
return valloc(size);
}
#endif

void *objc_realloc(void *mem, size_t size)
{
Expand Down
9 changes: 9 additions & 0 deletions properties.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
#include <stdio.h>
#include <unistd.h>

#ifdef __MINGW32__
#include <windows.h>
static unsigned sleep(unsigned seconds)
{
Sleep(seconds*1000);
return 0;
}
#endif

// Subset of NSObject interface needed for properties.
@interface NSObject {}
- (id)retain;
Expand Down

0 comments on commit 7a2c302

Please sign in to comment.