/* print example code */
int main(int argc,char *argv[]) {
fprintf(stdout,"Control reached in main()n");
return 0;
}
__attribute__((constructor)) and
__attribute__((destructor))
function attributes. Constructor routines are executed before dlopen
returns (or before main() is started if the library is loaded at load
time). Destructor routines are executed before dlclose returns (or
after exit() or completion of main() if the library is loaded at load
time). The C prototypes for these functions are:
void __attribute__ ((constructor)) my_init(void);
void __attribute__ ((destructor)) my_fini(void);
These two special functions, _init and _fini, can be used to control
constructors and destructors. However, they are obsolete, and their use
can lead to unpredicatable results. Libraries should not use these; use
the function attributes constructor and destructor above instead.