#pragma init and #pragma fini using gcc compiler on linux
- by Josh
I would like to build some code which calls some code on loadup of the shared library. I thought i would do it like this:
#pragma init(my_init)
static void my_init () {
//do-something }
int add (int a,int b) {
return a+b;
}
So when i build that code with
gcc -fPIC -g -c -Wall tt.c
It returns
gcc -fPIC -g -c -Wall…