Skip to content

Commit

Permalink
Make fishhook symbols hidden by default (facebook#29)
Browse files Browse the repository at this point in the history
Now when fishhook is included in a library/framework, fishhook functions will
no longer be exported from that library. Unless specifically configured to.
This seems like the right thing to do by default, and prevents issues that can
arise from multiple embedded instances of fishhook.
  • Loading branch information
kastiglione authored and grp committed Aug 1, 2016
1 parent 3958ea3 commit 27dd826
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fishhook.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
#include <stddef.h>
#include <stdint.h>

#if !defined(FISHHOOK_EXPORT)
#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden")))
#else
#define FISHHOOK_VISIBILITY __attribute__((visibility("default")))
#endif

#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
Expand All @@ -49,12 +55,14 @@ struct rebinding {
* rebind are added to the existing list of rebindings, and if a given symbol
* is rebound more than once, the later rebinding will take precedence.
*/
FISHHOOK_VISIBILITY
int rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel);

/*
* Rebinds as above, but only in the specified image. The header should point
* to the mach-o header, the slide should be the slide offset. Others as above.
*/
FISHHOOK_VISIBILITY
int rebind_symbols_image(void *header,
intptr_t slide,
struct rebinding rebindings[],
Expand Down

0 comments on commit 27dd826

Please sign in to comment.