Skip to content

Instantly share code, notes, and snippets.

@jfo
Created August 21, 2018 18:38
Show Gist options
  • Save jfo/ca6d575219788d7c7fa2a93b22b0e09c to your computer and use it in GitHub Desktop.
Save jfo/ca6d575219788d7c7fa2a93b22b0e09c to your computer and use it in GitHub Desktop.
#include <stdio.h>
void lib1f(void (*f)()) {
printf("lib1 now calling function:\n");
f();
printf("lib1 done!\n");
}
void lib2f(void (*f)()) {
printf("lib2 now calling function:\n");
f();
printf("lib2 done!\n");
}
void udf() {
printf("Hello World!\n");
}
void *g = NULL;
void tf () {
lib2f(g);
}
void mergelibf(void (*f)()) {
g = f;
lib1f(tf);
}
int main() {
mergelibf(udf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment