--- src/common/apple/SoftLinking.h	2026-06-05 08:03:27.000000000 +0800
+++ src/common/apple/SoftLinking.h	2026-06-14 23:23:51.000000000 +0800
@@ -15,9 +15,9 @@
 
 #    include "common/debug.h"
 
-#    import <dispatch/dispatch.h>
-#    import <dlfcn.h>
-#    import <objc/runtime.h>
+#    include <dlfcn.h>
+#    include <objc/runtime.h>
+#    include <pthread.h>
 
 #    ifdef __cplusplus
 #        define EXTERN_C_BEGIN extern "C" {
@@ -30,16 +30,18 @@
 #    define SOFT_LINK_FRAMEWORK_HEADER(framework) extern void *framework##Library();
 
 #    define SOFT_LINK_FRAMEWORK_SOURCE(framework)                                               \
+        static void *framework##LibraryHandle = NULL;                                           \
+        static void init##framework##Library(void)                                              \
+        {                                                                                       \
+            framework##LibraryHandle = dlopen(                                                  \
+                "/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW);   \
+            RELEASE_ASSERT(framework##LibraryHandle);                                           \
+        }                                                                                       \
         void *framework##Library()                                                              \
         {                                                                                       \
-            static dispatch_once_t once   = 0;                                                  \
-            static void *frameworkLibrary = NULL;                                               \
-            dispatch_once(&once, ^{                                                             \
-              frameworkLibrary = dlopen(                                                        \
-                  "/System/Library/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
-              RELEASE_ASSERT(frameworkLibrary);                                                 \
-            });                                                                                 \
-            return frameworkLibrary;                                                            \
+            static pthread_once_t once = PTHREAD_ONCE_INIT;                                     \
+            pthread_once(&once, init##framework##Library);                                      \
+            return framework##LibraryHandle;                                                    \
         }
 
 #    define SOFT_LINK_FUNCTION_HEADER(framework, functionName, resultType, parameterDeclarations, \
@@ -56,15 +58,17 @@
 
 #    define SOFT_LINK_FUNCTION_SOURCE(framework, functionName, resultType, parameterDeclarations,  \
                                       parameterNames)                                              \
+        static void init##framework##functionName##Ptr(void)                                       \
+        {                                                                                          \
+            softLink##framework##functionName =                                                    \
+                (resultType(*)parameterDeclarations)dlsym(framework##Library(), #functionName);    \
+        }                                                                                          \
         resultType(*softLink##framework##functionName) parameterDeclarations =                     \
             init##framework##functionName;                                                         \
         resultType init##framework##functionName parameterDeclarations                             \
         {                                                                                          \
-            static dispatch_once_t once;                                                           \
-            dispatch_once(&once, ^{                                                                \
-              softLink##framework##functionName =                                                  \
-                  (resultType(*) parameterDeclarations)dlsym(framework##Library(), #functionName); \
-            });                                                                                    \
+            static pthread_once_t once = PTHREAD_ONCE_INIT;                                        \
+            pthread_once(&once, init##framework##functionName##Ptr);                               \
             return softLink##framework##functionName parameterNames;                               \
         }
 
@@ -76,9 +80,16 @@
 
 #    define SOFT_LINK_CLASS(framework, className)                                      \
         @class className;                                                              \
+        static Class class##className;                                                 \
+        static void init##className##Ptr(void)                                         \
+        {                                                                              \
+            framework##Library();                                                      \
+            class##className = objc_getClass(#className);                              \
+            RELEASE_ASSERT(class##className);                                          \
+            get##className##Class = className##Function;                               \
+        }                                                                              \
         static Class init##className();                                                \
         Class (*get##className##Class)() = init##className;                            \
-        static Class class##className;                                                 \
                                                                                        \
         static Class className##Function()                                             \
         {                                                                              \
@@ -87,13 +98,8 @@
                                                                                        \
         static Class init##className()                                                 \
         {                                                                              \
-            static dispatch_once_t once;                                               \
-            dispatch_once(&once, ^{                                                    \
-              framework##Library();                                                    \
-              class##className = objc_getClass(#className);                            \
-              RELEASE_ASSERT(class##className);                                        \
-              get##className##Class = className##Function;                             \
-            });                                                                        \
+            static pthread_once_t once = PTHREAD_ONCE_INIT;                            \
+            pthread_once(&once, init##className##Ptr);                                 \
             return class##className;                                                   \
         }                                                                              \
         _Pragma("clang diagnostic push")                                               \
