Created
May 22, 2018 16:24
-
-
Save mikeash/e570ca36b42c18657b5196c53eea5a3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <dlfcn.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
Dl_info info; | |
int success = dladdr(main, &info); | |
if (success == 0) abort(); | |
printf("main is at %p and the mach-o header that contains it is at %p\n", main, info.dli_fbase); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment