Skip to content

Instantly share code, notes, and snippets.

@kishikawakatsumi
Created March 27, 2012 15:32
Show Gist options
  • Save kishikawakatsumi/2217051 to your computer and use it in GitHub Desktop.
Save kishikawakatsumi/2217051 to your computer and use it in GitHub Desktop.
Reflection C function call by ffcall
#include <stdio.h>
#include <dlfcn.h>
#include <avcall.h>
int main(int argc, char *argv[]) {
int ret;
av_alist alist;
void *dlh;
void *fp;
dlh = dlopen(argv[0], RTLD_LAZY);
fp = dlsym(dlh, "puts");
av_start_int(alist, fp, &ret);
av_ptr(alist, char *, "Hello World!");
av_call(alist);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment