blob: 526150666956ec0778355e7e56bfe2875f7da669 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include <stdio.h>
2#include <pthread.h>
3
4void __attribute__((constructor)) libtest2_ctor(void);
5void libtest2_ctor(void)
6{
7 printf("libtest2: constructor!\n");
8}
9
10void __attribute__((destructor)) libtest2_dtor(void);
11void libtest2_dtor(void)
12{
13 printf("libtest2: destructor!\n");
14}
15
16void function1(void);
17void function1(void)
18{
19 printf("libtest2: I am function1!\n");
20}
21
22void __attribute__((weak)) function2(void);
23void function2(void)
24{
25 printf("libtest2: I am weak function2!\n");
26}
27
28
29int libtest2_func(const char *s);
30int libtest2_func(const char *s)
31{
32 printf( "libtest2: function1 = %p\n"
33 "libtest2: function2 = %p\n",
34 function1, function2);
35 function1();
36 function2();
37 return 0;
38}