Created
January 27, 2010 23:54
-
-
Save stepancheg/288290 to your computer and use it in GitHub Desktop.
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 <stdlib.h> | |
#include <time.h> | |
static int __my_func_impl_1() { | |
return 44; | |
} | |
static int __my_func_impl_2() { | |
return 55; | |
} | |
asm(".type my_func,@gnu_indirect_function"); | |
void* my_func() { | |
srandom(time(0)); | |
if (random() % 2 == 0) | |
return &__my_func_impl_1; | |
else | |
return &__my_func_impl_2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment