Index: test/lang/c/shared_lib/foo.h =================================================================== --- test/lang/c/shared_lib/foo.h +++ test/lang/c/shared_lib/foo.h @@ -6,7 +6,7 @@ char *sub_2; }; -struct foo *GetMeAFoo(); -struct sub_foo *GetMeASubFoo (struct foo *in_foo); +DLLEXPORT struct foo *GetMeAFoo(); +DLLEXPORT struct sub_foo *GetMeASubFoo (struct foo *in_foo); Index: test/make/Makefile.rules =================================================================== --- test/make/Makefile.rules +++ test/make/Makefile.rules @@ -114,6 +114,7 @@ CFLAGS ?= -g -O0 CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include +CFLAGS += -include $(THIS_FILE_DIR)test_common.h # Use this one if you want to build one part of the result without debug information: CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) @@ -148,6 +149,8 @@ ifneq "$(DYLIB_NAME)" "" ifeq "$(OS)" "Darwin" DYLIB_FILENAME = lib$(DYLIB_NAME).dylib + else ifeq "$(OS)" "Windows_NT" + DYLIB_FILENAME = $(DYLIB_NAME).dll else DYLIB_FILENAME = lib$(DYLIB_NAME).so endif @@ -391,7 +394,7 @@ #---------------------------------------------------------------------- # Automatic variables based on items already entered. Below we create -# an objects lists from the list of sources by replacing all entries +# an object's lists from the list of sources by replacing all entries # that end with .c with .o, and we also create a list of prerequisite # files by replacing all .c files with .d. #---------------------------------------------------------------------- @@ -405,28 +408,36 @@ # the compiler -MM option. The -M option will list all system headers, # and the -MM option will list all non-system dependencies. #---------------------------------------------------------------------- +ifeq "$(OS)" "Windows_NT" + SEMICOLON = & + QUOTE = " +else + SEMICOLON = ; + QUOTE = ' +endif + %.d: %.c - @rm -f $@; \ + @rm -f $@ $(SEMICOLON) \ $(CC) -M $(CFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(SEMICOLON) \ rm -f $@.tmp %.d: %.cpp - @rm -f $@; \ + @rm -f $@ $(SEMICOLON) \ $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(SEMICOLON) \ rm -f $@.tmp %.d: %.m - @rm -f $@; \ + @rm -f $@ $(SEMICOLON) \ $(CC) -M $(CFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(SEMICOLON) \ rm -f $@.tmp %.d: %.mm - @rm -f $@; \ + @rm -f $@ $(SEMICOLON) \ $(CXX) -M $(CXXFLAGS) $< > $@.tmp && \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.tmp > $@; \ + sed $(QUOTE)s,\($*\)\.o[ :]*,\1.o $@ : ,g$(QUOTE) < $@.tmp > $@ $(SEMICOLON) \ rm -f $@.tmp #---------------------------------------------------------------------- @@ -457,6 +468,10 @@ endif ifeq "$(OS)" "Windows_NT" $(RM) "$(EXE).manifest" $(wildcard *.pdb *.ilk) + ifneq "$(DYLIB_NAME)" "" + $(RM) $(DYLIB_FILENAME).manifest + $(RM) $(DYLIB_NAME).lib $(DYLIB_NAME).exp + endif endif #---------------------------------------------------------------------- Index: test/make/test_common.h =================================================================== --- /dev/null +++ test/make/test_common.h @@ -0,0 +1,7 @@ +// This header is included in all the test programs (C and C++) and provides a +// hook for dealing with platform-specifics. +#if defined(_WIN32) || defined(_WIN64) + #define DLLEXPORT __declspec(dllexport) +#else + #define DLLEXPORT +#endif