Created
August 7, 2017 14:31
-
-
Save justdoit0823/1be17d0dee920c96609eaed6324aa696 to your computer and use it in GitHub Desktop.
Check dynamic function call analyze.
This file contains hidden or 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 "stdio.h" | |
#include "stdlib.h" | |
#include "string.h" | |
#include <sys/utsname.h> | |
typedef void (*func) (void); | |
void darwin_show_sys(){ | |
printf("show darwin system info.\n"); | |
} | |
void linux_show_sys(){ | |
printf("show linux system info.\n"); | |
} | |
int main(int argc, char * argv[]){ | |
func test_func; | |
struct utsname sys_name; | |
uname(&sys_name); | |
if(strcmp(sys_name.sysname, "Darwin") == 0) test_func = darwin_show_sys; | |
else test_func = linux_show_sys; | |
test_func(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment