summaryrefslogtreecommitdiffstats
path: root/test/dlopen/libtest2.c
blob: b2eb02e88143a8befb245ddf9da86d336adc9eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <pthread.h>


extern int __pthread_mutex_init (void);

void __attribute__((constructor)) libtest2_ctor(void)
{
    printf("libtest2: constructor!\n");
}

void __attribute__((destructor)) libtest2_dtor(void)
{
    printf("libtest2: destructor!\n");
}

void function1(void)
{
    printf("libtest2: I am function1!\n");
}

void __attribute__((weak)) function2(void)
{
    printf("libtest2: I am weak function2!\n");
}


int libtest2_func(const char *s)
{
    printf( "libtest2: function1 = %p\n"
	    "libtest2: function2 = %p\n",
	    function1, function2);
    function1();
    function2();
    return 0;
}