| 1 | // -*- C++ -*- |
| 2 | |
| 3 | #ifndef HL_MACINTERPOSE_H |
| 4 | #define HL_MACINTERPOSE_H |
| 5 | |
| 6 | // The interposition data structure (just pairs of function pointers), |
| 7 | // used an interposition table like the following: |
| 8 | // |
| 9 | |
| 10 | typedef struct interpose_s { |
| 11 | void *new_func; |
| 12 | void *orig_func; |
| 13 | } interpose_t; |
| 14 | |
| 15 | #define MAC_INTERPOSE(newf,oldf) __attribute__((used)) \ |
| 16 | static const interpose_t macinterpose##newf##oldf \ |
| 17 | __attribute__ ((section("__DATA, __interpose"))) = \ |
| 18 | { (void *) newf, (void *) oldf } |
| 19 | |
| 20 | #endif |