GNU C 中的__attribute__ (二)
来源:互联网 发布:烧香拜佛软件 编辑:程序博客网 时间:2024/06/08 08:14
constructor and destructor:
./test
begin!
begin() = 0×8048465
end() = 0×8048479
end!
The constructor attribute causes the function to be called automatically before execution enters main (). Similarly, the destructor attribute causes the function to be called automatically after main () has completed or exit () has been called. Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program.
static void begin(void) __attribute__ ((constructor));static void end(void) __attribute__ ((destructor));int main(int argc, char *argv[]){ printf("begin() = %p\n", begin); printf("end() = %p\n", end); exit(0);}void begin(void){ printf("begin!\n");}void end(void){ printf("end!\n");}
outputs:
gcc -o test test.c./test
begin!
begin() = 0×8048465
end() = 0×8048479
end!
- GNU C 中的__attribute__ (二)
- GNU C 中的__attribute__ (一)
- GNU C中的__attribute__机制
- GNU C中的__attribute__机制
- GNU C: __attribute__
- GNU C __attribute__ 精解
- Using GNU C __attribute__
- GNU C __attribute__ 机制
- GNU C __attribute__ 用法
- GNU C __attribute__
- Using GNU C __attribute__
- Using GNU C __attribute__
- Using GNU C __attribute__
- GNU C __attribute__ 机制
- GNU c __attribute__详解
- GNU C 之 __attribute__
- (GNU C)__attribute__机制
- GNU C __attribute__
- 一个猜测程序 用户心里选择一个数 让计算机询问用户是否正确并做控制 知道猜对数字(图)
- 2008.08.06_RolfRolles_VMProtect
- 苹果园租房11号问询
- linux shell生成oracle uuid
- chapter1 数据库的设计---2预习检查
- GNU C 中的__attribute__ (二)
- VC++ SetTimer
- 第十二周任务二(理解基类成员的访问限定符和派生类的继承方式)
- 快速排序
- Mongoose(SHTTP)+LUA
- 初学 Java Web 开发,请远离各种框架,从 Servlet 开发
- PHP使用APNS的 feedback service
- Map 集合转换成二维数组
- hdu oj 1010解题报告