Skip to content

Commit

Permalink
Replace extern with OBJC_HOOK in hooks.h
Browse files Browse the repository at this point in the history
This lets us stick __attribute__((dllimport)) on exported hooks so that
win32 consumers may manipulate them without mangling their import
symbols.
  • Loading branch information
DHowett committed Jan 22, 2018
1 parent 0b2cfdc commit b6099e5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions objc/hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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);

/**
Expand Down

0 comments on commit b6099e5

Please sign in to comment.