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
#include <stdio.h> #include <stdlib.h> extern int foo(); extern int bar(); static __attribute__((constructor)) void main_init() { printf("main_init\n"); } static __attribute__((destructor)) void main_term() { printf("main_term\n"); } int main() { printf("main\n"); foo(); return 0; }