Skip to content

Commit

Permalink
Make fishhook symbols hidden by default
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
Dave Lee committed Aug 1, 2016
1 parent 3958ea3 commit 46329b8
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 @@ -24,6 +24,12 @@
#ifndef fishhook_h
#define fishhook_h

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

#include <stddef.h>
#include <stdint.h>

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 46329b8

Please sign in to comment.