From b6099e540b7019e9326c88a7ca98dd3fb0b5d4ba Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Wed, 6 Jan 2016 13:55:45 -0800 Subject: [PATCH] Replace extern with OBJC_HOOK in hooks.h This lets us stick __attribute__((dllimport)) on exported hooks so that win32 consumers may manipulate them without mangling their import symbols. --- objc/hooks.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/objc/hooks.h b/objc/hooks.h index 42c67edd..eb9f58e8 100644 --- a/objc/hooks.h +++ b/objc/hooks.h @@ -7,10 +7,14 @@ * of the runtime. */ - #ifndef OBJC_HOOK +#if defined(_WIN32) +#define OBJC_HOOK extern __attribute__((dllimport)) +#else #define OBJC_HOOK extern #endif +#endif + struct objc_category; /** * Class lookup hook. Set this to provide a mechanism for resolving classes @@ -30,13 +34,13 @@ OBJC_HOOK void (*_objc_load_callback)(Class cls, struct objc_category *category) * The hook used for fast proxy lookups. This takes an object and a selector * and returns the instance that the message should be forwarded to. */ -extern id (*objc_proxy_lookup)(id receiver, SEL op); +OBJC_HOOK id (*objc_proxy_lookup)(id receiver, SEL op); /** * New runtime forwarding hook. This might be removed in future - it's * actually no more expressive than the forward2 hook and forces Foundation to * do some stuff that the runtime is better suited to. */ -extern struct objc_slot *(*__objc_msg_forward3)(id, SEL); +OBJC_HOOK struct objc_slot *(*__objc_msg_forward3)(id, SEL); /** * Forwarding hook. Takes an object and a selector and returns a method that * handles the forwarding. @@ -66,7 +70,7 @@ OBJC_HOOK Class (*_objc_class_for_boxing_foreign_exception)(int64_t exceptionCla * receiver. This should return the slot to use instead, although it may throw * an exception or perform some other action. */ -extern struct objc_slot* (*_objc_selector_type_mismatch)(Class cls, +OBJC_HOOK struct objc_slot* (*_objc_selector_type_mismatch)(Class cls, SEL selector, struct objc_slot *result); /**