aboutsummaryrefslogtreecommitdiff
path: root/lib/substitute.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/substitute.h')
-rw-r--r--lib/substitute.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/substitute.h b/lib/substitute.h
index cadfa80..d4287fb 100644
--- a/lib/substitute.h
+++ b/lib/substitute.h
@@ -5,6 +5,8 @@
#pragma once
+#include <stdlib.h>
+
// TODO add numbers
enum {
SUBSTITUTE_OK = 0,
@@ -14,26 +16,31 @@ enum {
int substitute_hook_function(void *function, void *replacement, int options, void *result);
-/* Darwin specific */
+#if 1 /* declare substitute_find_syms? */
+
#ifdef __APPLE__
#include <mach-o/nlist.h>
#ifdef __LP64__
-typedef struct nlist_64 substitute_nlist;
+typedef struct nlist_64 substitute_sym;
#else
-typedef struct nlist substitute_nlist;
+typedef struct nlist substitute_sym;
+#endif
+#else
+#error No definition for substitute_sym!
#endif
/* Look up private symbols in an image currently loaded into the process.
- * Vaguely inspired by nlist(3), but somewhat different.
*
- * @filename the executable/library path (c.f. dyld(3))
+ * @filename the executable/library path (c.f. dyld(3) on Darwin)
* @names an array of symbol names to search for
- * @nlist an array of substitute_nlist *, one per name; on return, each entry
+ * @nlist an array of substitute_sym *, one per name; on return, each entry
* will be a pointer into the symbol table for that image, or NULL if the
* symbol wasn't found
* @count number of names
*
* @return SUBSTITUTE_OK or SUBSTITUTE_ERR_MODULE_NOT_FOUND
*/
-int substitute_nlist(const char *filename, const char **names,
- substitute_nlist **nlist, size_t count);
+int substitute_find_syms(const char *filename, const char **names,
+ substitute_sym **syms, size_t count);
+
+#endif /* 1 */