summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@heap.zone>2018-10-28 00:38:08 +0200
committerJonathan Schleifer <js@heap.zone>2018-10-28 00:38:08 +0200
commit65e2c1c5ab34811c73d06728699b1c16fa09fc69 (patch)
tree5799032bac97cd57f90825ab225a23cbd0f21dde
parent0d685982d2e5722131e97938841b413af1fa7efa (diff)
Only use dllexport when we have no shared library
-rw-r--r--configure.ac1
-rw-r--r--src/block.h3
-rw-r--r--src/objfw-defs.h.in1
-rw-r--r--tests/OFBlockTests.m2
4 files changed, 5 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 39fecc53..ef9e9bbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -341,6 +341,7 @@ AS_IF([test x"$enable_shared" != x"no"], [
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")
])
diff --git a/src/block.h b/src/block.h
index 29165691..23f8cfa3 100644
--- a/src/block.h
+++ b/src/block.h
@@ -43,7 +43,8 @@ extern "C" {
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
diff --git a/src/objfw-defs.h.in b/src/objfw-defs.h.in
index b3de2942..25d6e38c 100644
--- a/src/objfw-defs.h.in
+++ b/src/objfw-defs.h.in
@@ -42,6 +42,7 @@
#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
diff --git a/tests/OFBlockTests.m b/tests/OFBlockTests.m
index 6f9a35e1..ea770f56 100644
--- a/tests/OFBlockTests.m
+++ b/tests/OFBlockTests.m
@@ -72,7 +72,7 @@ forwardTest(void)
(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.