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. sql大全

    推荐一. 简单查询   简单的Transact-SQL查询只包括选择列表.FROM子句和Where子句.它们分别说明所查询列.查询的表或视图.以及搜索条件等. 例如,下面的语句查询testtable表 ...

  2. 翻译:非常详细易懂的法线贴图(Normal Mapping)

    翻译:非常详细易懂的法线贴图(Normal Mapping) 本文翻译自: Shaders » Lesson 6: Normal Mapping 作者: Matt DesLauriers 译者: Fr ...

  3. php email邮箱正则验证

    国际域名格式如下: 域名由各国文字的特定字符集.英文字母.数字及“-”(即连字符或减号)任意组合而成, 但开头及结尾均不能含有“-”,“-”不能连续出现 . 域名中字母不分大小写.域名最长可达60个字 ...

  4. 【OpenStack】OpenStack系列15之OpenStack高可用详解

    高可用 概念 级别 陈本 如何实现 分类 Openstack的HA 虚拟机的HA 虚拟机HA 比较 应用级别HA,Heat的HA模板   组件的HA 示意图 Mysql的HA 三种方式之一——主从同步 ...

  5. 【云计算】Dockerfile示例模板

    Dockerfile FROM debian:jessie MAINTAINER "Konrad Kleine" USER root ####################### ...

  6. iOS7 中的新加入的下载类NSURLSession(随ios版本更新而更新)

    想详细的了解网络下载的相关知识,要仔细阅读URL Loading System Programming Guide 这里有篇好文章(http://www.shinobicontrols.com/blo ...

  7. mysql in 查询优化

    2014年11月29日21:01:01 场景:有的时候查询数据库的select in 语句中会有非常多不连续的数值,会很影响查询效率 方法:将select in 查询转换成多个select betwe ...

  8. 转mysql复制主从集群搭建

    最近搭了个主从复制,中间出了点小问题,排查搞定,记录下来 1环境:虚拟机:OS:centos6.5Linux host2 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 ...

  9. CentOS6.5安装MySql5.5

    最近在CentOS上安装MySql,本来以为yum安装会很简单,但是却花了自己不少时间,所以决定和大家分享下. 首先,安装MySql源! 下载地址:http://dev.mysql.com/downl ...

  10. 【linux】awk的使用

    教程来自:http://www.runoob.com/linux/linux-comm-awk.html 教程中的例子很好,可以有助于快速上手awk.但是里面的细节介绍的并不清楚. 问题1:什么时候写 ...