From 9b97024184caf3c315116fb3610200edc11c7ae4 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 1 Mar 2025 21:33:37 -0800 Subject: [PATCH] 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. --- Sources/CoreFoundation/CFRuntime.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/CoreFoundation/CFRuntime.c b/Sources/CoreFoundation/CFRuntime.c index 11c20ff0c1..3336852904 100644 --- a/Sources/CoreFoundation/CFRuntime.c +++ b/Sources/CoreFoundation/CFRuntime.c @@ -45,6 +45,10 @@ OBJC_EXPORT void *objc_destructInstance(id obj); #include #endif +#if __HAS_DISPATCH__ && !TARGET_OS_MAC +#include +#endif + enum { // retain/release recording constants -- must match values // used by OA for now; probably will change in the future @@ -1165,8 +1169,8 @@ CF_EXPORT CF_PRIVATE os_unfair_recursive_lock CFPlugInGlobalDataLock; -#if __HAS_DISPATCH__ -extern void libdispatch_init(); +#if __HAS_DISPATCH__ && !TARGET_OS_MAC +DISPATCH_EXPORT void libdispatch_init(); #endif void __CFInitialize(void) {