您的位置:首页 > 大数据 > 人工智能

Insert Function before and after main function

2013-08-23 22:50 309 查看
Source code:

#include<stdio.h>


void myStartupFun (void) __attribute__ ((constructor));


void myCleanupFun (void) __attribute__ ((destructor));


  


/* implementation of myStartupFun */


void myStartupFun (void)


{


    printf ("startup code before main()\n");


}


 


/* implementation of myCleanupFun */


void myCleanupFun (void)


{


    printf ("cleanup code after main()\n");


}


 


int main (void)


{


    printf ("hello\n");


    return 0;


}


 

Just compile the source code, and run, you will find the interesting result.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: