Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -339,10 +339,11 @@ BUILDSYS_FRAMEWORK([ AC_SUBST(OBJFW_FRAMEWORK, "ObjFW.framework") build_framework="yes" ]) ], [ + AC_DEFINE(OF_NO_SHARED, 1, [Whether no shared library was built]) AC_SUBST(LIBOBJFW_DEP, "../src/libobjfw.a") AC_SUBST(LIBOBJFW_DEP_LVL2, "../../src/libobjfw.a") ]) AS_IF([test x"$build_framework" = x"yes"], [ Index: src/block.h ================================================================== --- src/block.h +++ src/block.h @@ -41,11 +41,12 @@ extern "C" { #endif extern void *_Block_copy(const void *); extern void _Block_release(const void *); -# ifdef OF_WINDOWS +# if defined(OF_WINDOWS) && \ + (defined(OF_NO_SHARED) || defined(OF_COMPILING_OBJFW)) /* * Clang has implicit declarations for these, but they are dllimport. When * compiling ObjFW itself or using it as a static library, these need to be * dllexport. Interestingly, this still works when using it as a shared library. */ Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -40,12 +40,13 @@ #undef OF_HAVE_UNICODE_TABLES #undef OF_HAVE__THREAD_LOCAL #undef OF_HAVE___THREAD #undef OF_NINTENDO_3DS #undef OF_NINTENDO_DS +#undef OF_NO_SHARED #undef OF_OBJFW_RUNTIME #undef OF_UNIVERSAL #undef OF_WII #undef SIZE_MAX #undef UINTPTR_MAX #undef ULLONG_MAX #undef __have_longlong64 Index: tests/OFBlockTests.m ================================================================== --- tests/OFBlockTests.m +++ tests/OFBlockTests.m @@ -70,11 +70,11 @@ TEST(@"Class of stack block", (Class)&_NSConcreteStackBlock == objc_getClass("OFStackBlock") && [s isKindOfClass: [OFBlock class]]) -#if !defined(OF_WINDOWS) || !defined(__clang__) +#if !defined(OF_WINDOWS) || !defined(__clang__) || !defined(OF_NO_SHARED) /* * Causes a linker error on Windows with Clang when compiling as a * static library. This is a bug in Clang. */ TEST(@"Class of global block",