Skip to content

Commit 328e888

Browse files
committed
Use __declspec(selectany) on any windows compiler, not only MSVC
GCC and Clang (in MinGW mode) also do support __declspec(selectany), and using __declspec(selectany) instead of __attribute__((weak)) on Windows avoids including the data multiple times in the linked image. (__attribute__((weak)), on COFF at least, only avoids a conflict for multiple definitions but doesn't deduplicate the content, like __declspec(selectany) does.) This avoids the fact that Clang doesn't fully implement __attribute__((weak)) on Windows yet.
1 parent eb931aa commit 328e888

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

amf/public/include/core/Platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
#endif // WIN32
132132

133133

134-
#if defined(_MSC_VER)
134+
#if defined(_WIN32)
135135
#define AMF_WEAK __declspec( selectany )
136136
#elif defined (__GNUC__) || defined (__GCC__) || defined(__clang__)//GCC or CLANG
137137
#define AMF_WEAK __attribute__((weak))

0 commit comments

Comments
 (0)