source: SHX/trunk/sandbox/access1.c @ 265

Revision 265, 297 bytes checked in by marcus, 10 years ago (diff)

showing that a shared lib is loaded only once in a process

Line 
1// build shared lib via
2// gcc -shared -o accesslib.so access1.c access2.c
3
4#include <stdio.h>
5
6int a = 0;
7static int c = 5;
8
9void printa() {
10        printf("%d %d\n", a, c);
11        c ++;
12}
13
14int *getcvar() {
15        return &c;
16}
17
18int main() {
19        int *x;
20       
21        printa();
22        inc(c);
23       
24        x = getcvar();
25       
26        printf("%d\n", *x);
27}
Note: See TracBrowser for help on using the repository browser.