plugin test for the mentally unwell. I feel bad for using recursive Make.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

33 lines
655B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5. #include <dlfcn.h>
  6. #include "plug.h"
  7. int
  8. main (void)
  9. {
  10. int x = 0;
  11. char * libplug_fn = "./libplug.so";
  12. void * libplug = NULL;
  13. while (1)
  14. {
  15. libplug = dlopen(libplug_fn, RTLD_NOW);
  16. if (!libplug)
  17. { fprintf(stderr, "ERR: Cannot load dynamic library %s: %s\n", libplug_fn, dlerror()); }
  18. else
  19. {
  20. PLUGIN(libplug, plug);
  21. printf("frame %d: ", x++);
  22. if (plug)
  23. { plug(); }
  24. else
  25. { fprintf(stderr, "ERR: Cannot find %s symbol in %s: %s\n", "plug", libplug_fn, dlerror()); }
  26. dlclose(libplug);
  27. }
  28. sleep(2);
  29. }
  30. }