Created
September 11, 2017 15:30
-
-
Save XanClic/91250ab8d02eb24ecd726fe2c4ba27be 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 <stdint.h> | |
#include <stdio.h> | |
#include <trampoline.h> | |
static void *i; | |
static int fn(void) | |
{ | |
printf("%i\n", (int)(uintptr_t)i); | |
return 0; | |
} | |
int main(void) | |
{ | |
int (*f)(void) = alloc_trampoline(fn, &i, (void *)42UL); | |
f(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ gcc trampoline.c -ltrampoline
$ ./a.out
42