Part of WebCore should use CFNetwork-based loader on Mac
[WebKit-https.git] / Source / WebCore / platform / mac / SoftLinking.h
index ce72f34edfcc8593f7c3edf2d315fc1855ec4042..885b27e70f425b98216f0ae27eed33d57669888e 100644 (file)
         return frameworkLibrary; \
     }
 
+#define SOFT_LINK_FRAMEWORK_IN_CORESERVICES_UMBRELLA(framework) \
+    static void* framework##Library() \
+    { \
+        static void* frameworkLibrary = dlopen("/System/Library/Frameworks/CoreServices.framework/Frameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+        ASSERT(frameworkLibrary); \
+        return frameworkLibrary; \
+    }
+
 #define SOFT_LINK(framework, functionName, resultType, parameterDeclarations, parameterNames) \
     static resultType init##functionName parameterDeclarations; \
     static resultType (*softLink##functionName) parameterDeclarations = init##functionName; \
         return softLink##functionName parameterNames; \
     }
 
+/* callingConvention is unused on Mac but is here to keep the macro prototype the same between Mac and Windows. */
+#define SOFT_LINK_OPTIONAL(framework, functionName, resultType, callingConvention, parameterDeclarations) \
+    typedef resultType (*functionName##PtrType) parameterDeclarations; \
+    \
+    static functionName##PtrType functionName##Ptr() \
+    { \
+        static functionName##PtrType ptr = reinterpret_cast<functionName##PtrType>(dlsym(framework##Library(), #functionName)); \
+        return ptr; \
+    }
+
 #define SOFT_LINK_CLASS(framework, className) \
     static Class init##className(); \
     static Class (*get##className##Class)() = init##className; \