Source code:

   1: #include<stdio.h>

   2: void myStartupFun (void) __attribute__ ((constructor));

   3: void myCleanupFun (void) __attribute__ ((destructor));

   4:   

   5: /* implementation of myStartupFun */

   6: void myStartupFun (void)

   7: {

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

   9: }

  10:  

  11: /* implementation of myCleanupFun */

  12: void myCleanupFun (void)

  13: {

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

  15: }

  16:  

  17: int main (void)

  18: {

  19:     printf ("hello\n");

  20:     return 0;

  21: }

 

Just compile the source code, and run, you will find the interesting result.

Insert Function before and after main function的更多相关文章

  1. [Cycle.js] Customizing effects from the main function

    How can we show one string on the DOM, and a completely different string on Console log? This lesson ...

  2. [Cycle.js] Main function and effects functions

    We need to give structure to our application with logic and effects. This lessons shows how we can o ...

  3. Main function

    Main function A program shall contain a global function named main, which is the designated start of ...

  4. The App Life Cycle & The Main Function

    The App Life Cycle Apps are a sophisticated interplay between your custom code and the system framew ...

  5. SetApartmentState(ApartmentState state).Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process

    System.Threading.ThreadStateException: 'Current thread must be set to single thread apartment (STA) ...

  6. Adding New Functions to MySQL(User-Defined Function Interface UDF、Native Function)

    catalog . How to Add New Functions to MySQL . Features of the User-Defined Function Interface . User ...

  7. 在JS中关于堆与栈的认识function abc(a){ a=100; } function abc2(arr){ arr[0]=0; }

    平常我们的印象中堆与栈就是两种数据结构,栈就是先进后出:堆就是先进先出.下面我就常见的例子做分析: main.cpp int a = 0; 全局初始化区 char *p1; 全局未初始化区 main( ...

  8. 洛谷P1464 Function  HDU P1579 Function Run Fun

    洛谷P1464 Function HDU P1579 Function Run Fun 题目描述 对于一个递归函数w(a,b,c) 如果a≤0 or b≤0 or c≤0就返回值11. 如果a> ...

  9. JavaScript中函数function fun(){}和 var fun=function(){}的区别

    function fun(){} 和 var fun=function(){}的区别 标题有点长···· 废话少说,其实他们的主要区别就是"函数声明的提前行为". var fun= ...

随机推荐

  1. 调用python 报R6034 错误

    R6034 指的是:"An application has made an attempt to load the C runtime library incorrectly. Please ...

  2. 将XML解析成DOM文档

    在支持html5的浏览其中,可以使用标准解析器DOMParser对象进行解析html或者xml等字符串 var data = '<div></div>'; var tmp = ...

  3. 分享一个强大的采集类,还可以模拟php多进程

    做采集的时候,可以使用file_get_contents()去获取网页源代码,但是使用file_get_contents采集,速度慢,而且超时时间,不好控制.如果采集的页面不存在,需要等待的时间很长. ...

  4. 【转】solr+ajax智能拼音详解---solr跨域请求

    本文转自:http://blog.csdn.net/wangzhaodong001/article/details/8529090 最近刚做完solr的ajax智能拼音.总结一下. 前端:jQuery ...

  5. codeforces A. Sereja and Bottles 解题报告

    题目链接:http://codeforces.com/problemset/problem/315/A 题目意思:有n个soda bottles,随后给出这n个soda bottles的信息.已知第 ...

  6. 使用Memory Analyzer tool(MAT)分析内存泄漏(一)

    转载自:http://www.blogjava.net/rosen/archive/2010/05/21/321575.html 前言 在平时工作过程中,有时会遇到OutOfMemoryError,我 ...

  7. July 11th, Week 29th Monday, 2016

    I want to win a trophy, it's the most important. 我希望获得冠军奖杯,这是最重要的事情. Win a trophy, stand on the very ...

  8. 0x和H都表示十六进制有什么区别吗?

    0x是16进制的前缀,H是16进制的后缀 都是表示十六进制数,意义上没有什么区别,完全相等.至于什么时候用0x,什么时候用H,这取决于你在什么环境下使用,如果在C/C++,必须用0x来表示. 在C语言 ...

  9. android JNI调用(转)

    Android jni开发资料--NDK环境搭建 android开发人员注意了 谷歌改良了ndk的开发流程,对于Windows环境下NDK的开发,如果使用的NDK是r7之前的版本,必须要安装Cygwi ...

  10. hdu 2545(并查集求节点到根节点的距离)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2545 思路:dist[u]表示节点u到根节点的距离,然后在查找的时候更新即可,最后判断dist[u], ...