main函数前后

void f1(void)__attribute__((constructor));
void f2(void)__attribute__((destructor));

void f1(void)
{
    puts("f1");
}

int main()
{
    puts("main");

    return 0;
}

void f2(void)
{
    puts("f2");
}
# ./a.out 
f1
main
f2
posted @ 2017-05-29 10:46  thomas_blog  阅读(91)  评论(0编辑  收藏  举报