Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Created August 7, 2017 14:31
Show Gist options
  • Save justdoit0823/1be17d0dee920c96609eaed6324aa696 to your computer and use it in GitHub Desktop.
Save justdoit0823/1be17d0dee920c96609eaed6324aa696 to your computer and use it in GitHub Desktop.
Check dynamic function call analyze.
#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