Skip to content

Commit 853b681

Browse files
committed
CoreFoundation: adjust declaration of private SPI
The SPI declaration for `libdispatch_init` was not attribtued properly. The result of this omission was an improper reference to the function on Windows when disaptch is _not_ linked statically. Correct the declaration by re-using the `DISPATCH_EXPORT` macro to decorate the declaration with the appropriate DLLStorage as necessary. This was caught by running the Foundation tests with SPM with a refactoring of the toolchain layout during the build.
1 parent 54c4e51 commit 853b681

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/CoreFoundation/CFRuntime.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ OBJC_EXPORT void *objc_destructInstance(id obj);
4545
#include <pathcch.h>
4646
#endif
4747

48+
#if __HAS_DISPATCH__ && !TARGET_OS_MAC
49+
#include <dispatch/dispatch.h>
50+
#endif
51+
4852
enum {
4953
// retain/release recording constants -- must match values
5054
// used by OA for now; probably will change in the future
@@ -1165,8 +1169,8 @@ CF_EXPORT
11651169

11661170
CF_PRIVATE os_unfair_recursive_lock CFPlugInGlobalDataLock;
11671171

1168-
#if __HAS_DISPATCH__
1169-
extern void libdispatch_init();
1172+
#if __HAS_DISPATCH__ && !TARGET_OS_MAC
1173+
DISPATCH_EXPORT void libdispatch_init();
11701174
#endif
11711175

11721176
void __CFInitialize(void) {

0 commit comments

Comments
 (0)