plugin test for the mentally unwell. I feel bad for using recursive Make.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

33 行
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. }