libtest2.c 592 B

123456789101112131415161718192021222324252627282930313233
  1. #include <stdio.h>
  2. #include <pthread.h>
  3. void __attribute__((constructor)) libtest2_ctor(void)
  4. {
  5. printf("libtest2: constructor!\n");
  6. }
  7. void __attribute__((destructor)) libtest2_dtor(void)
  8. {
  9. printf("libtest2: destructor!\n");
  10. }
  11. void function1(void)
  12. {
  13. printf("libtest2: I am function1!\n");
  14. }
  15. void __attribute__((weak)) function2(void)
  16. {
  17. printf("libtest2: I am weak function2!\n");
  18. }
  19. int libtest2_func(const char *s)
  20. {
  21. printf( "libtest2: function1 = %p\n"
  22. "libtest2: function2 = %p\n",
  23. function1, function2);
  24. function1();
  25. function2();
  26. return 0;
  27. }