diff --git a/config.mk b/config.mk index f16d87e..3b7bf53 100644 --- a/config.mk +++ b/config.mk @@ -24,7 +24,7 @@ endif endif ifeq ($(firstword $(filter %-mingw32 %-cygwin,$(DUMPMACHINE))),) - DLL_LDFLAGS = -fPIC -shared + DLL_LDFLAGS = -shared DLL_SUFFIX := .so else DLL_LDFLAGS = -shared -Wl,--out-implib,$@.a diff --git a/libhashset/Makefile b/libhashset/Makefile index 6106539..6f20115 100644 --- a/libhashset/Makefile +++ b/libhashset/Makefile @@ -1,6 +1,6 @@ include ../config.mk -CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -Iinclude $(XCFLAGS) +CFLAGS = -std=c99 -D_DEFAULT_SOURCE -Wpedantic -Iinclude -fPIC $(XCFLAGS) SRC_PATH := src OBJ_PATH := obj @@ -21,9 +21,9 @@ test: build build: $(ALL_PATH) $(LIB_FILE) $(DLL_FILE) $(LIB_FILE): $(OBJ_FILE) - $(AR) rcs $@ $^ + $(AR) rcs $@ $(filter-out $(OBJ_PATH)/dll%,$^) -$(DLL_FILE): $(SRC_FILE) +$(DLL_FILE): $(OBJ_FILE) $(CC) $(CFLAGS) $(DLL_LDFLAGS) -o $@ $^ $(OBJ_FILE): diff --git a/libhashset/libhashset.vcxproj b/libhashset/libhashset.vcxproj index 189fdfc..f49a5c4 100644 --- a/libhashset/libhashset.vcxproj +++ b/libhashset/libhashset.vcxproj @@ -46,6 +46,7 @@ + diff --git a/libhashset/libhashset.vcxproj.filters b/libhashset/libhashset.vcxproj.filters index 1be189e..335644b 100644 --- a/libhashset/libhashset.vcxproj.filters +++ b/libhashset/libhashset.vcxproj.filters @@ -53,5 +53,8 @@ Source Files + + Source Files + \ No newline at end of file diff --git a/libhashset/src/dll_main.c b/libhashset/src/dll_main.c new file mode 100644 index 0000000..7fa6475 --- /dev/null +++ b/libhashset/src/dll_main.c @@ -0,0 +1,29 @@ +/******************************************************************************/ +/* HashSet for C99, by LoRd_MuldeR */ +/* This work has been released under the CC0 1.0 Universal license! */ +/******************************************************************************/ + +#if defined(_WIN32) + +#define WIN32_LEAN_AND_MEAN 1 +#include + +BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +#elif defined(__GNUC__) + +void __attribute__((constructor)) libhashet_init(void) { /*noop*/ } +void __attribute__((destructor)) libhashet_exit(void) { /*noop*/ } + +#endif