Insert Function before and after main function
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的更多相关文章
- [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 ...
- [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 ...
- Main function
Main function A program shall contain a global function named main, which is the designated start of ...
- The App Life Cycle & The Main Function
The App Life Cycle Apps are a sophisticated interplay between your custom code and the system framew ...
- 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) ...
- 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 ...
- 在JS中关于堆与栈的认识function abc(a){ a=100; } function abc2(arr){ arr[0]=0; }
平常我们的印象中堆与栈就是两种数据结构,栈就是先进后出:堆就是先进先出.下面我就常见的例子做分析: main.cpp int a = 0; 全局初始化区 char *p1; 全局未初始化区 main( ...
- 洛谷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> ...
- JavaScript中函数function fun(){}和 var fun=function(){}的区别
function fun(){} 和 var fun=function(){}的区别 标题有点长···· 废话少说,其实他们的主要区别就是"函数声明的提前行为". var fun= ...
随机推荐
- django-cms 代码研究(二)bugs?
djangocms集成到现有项目中后,发现了几个问题: 1. 现有项目的url匹配失效,下面requests请求被交给djangocms处理了 url(r'^admin/', include(admi ...
- Find Leaves of Binary Tree
Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves ...
- 利用jQuery.validate异步验证用户名是否存在
转:http://www.cnblogs.com/linzheng/archive/2010/10/14/1851781.html HTML头部引用: <script type="te ...
- 【转】maven导出项目依赖的jar包
本文转自:http://my.oschina.net/cloudcoder/blog/212648 一.导出到默认目录 targed/dependency 从Maven项目中导出项目依赖的jar包:进 ...
- Greedy:Stripes(POJ 1826)
新生物 题目大意:给你一堆数,两两结合,答案为2*sqrt(x1*x2),问组合成一个数时,最小的量? 超级无敌大水题,排序或者用堆都可以,反正就是优先组合大的,让根号一直把大数开根降低整体的大小 # ...
- codeforces A. Domino 解题报告
题目链接:http://codeforces.com/problemset/problem/353/A 题目意思:通俗地说,就是当上下两半的数的总和不完全是偶数时,通过上下调换某些骨牌来使这两半的数和 ...
- July 25th, Week 31st Monday, 2016
We will not go quietly into the night. 今夜,我们将奋战到底. We will be the champion. We will not stop fightin ...
- Linux设置IP
进入 vi /etc/sysconfig/network-scripts/ifcfg-eth0 root # ifconfig eth0 192.168.22.232 root # route ad ...
- editplus快捷键大全
Eclipse快捷键 10个最有用的快捷键 1. ctrl+shift+r:打开资源 ctrl+b编译 ctrl+d删除 2. ctrl+o:快速outline --->这个是查看一个类中的用 ...
- JAVA读取XML文件数据
XML文档内容如下: <?xml version="1.0" encoding="UTF-8"?> <root> <field t ...