libtest2.c 636 B

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