GCC __attribute__((constructor和(destructor)) (Cygwin)
2011-11-23 09:30
281 查看
关注点:__attribute__机制,用于声明,而不是定义,并且其位置约束为放于声明的尾部“;”之前。
对于__attribute__((constructor和(destructor)) ,
用法一:
亦可如此使用:
两种用法都可。
参考文章:http://blog.csdn.net/polisan/article/details/5031142
对于__attribute__((constructor和(destructor)) ,
用法一:
void before_main() __attribute__((constructor)); void before_main() { printf("before main\n"); } void after_main() __attribute__((constructor)); void after_main() { printf("after main\n"); }
亦可如此使用:
__attribute__((constructor)) void before_main() { printf("before main\n"); } __attribute__((destructor)) void after_main() { printf("after main\n"); }
两种用法都可。
参考文章:http://blog.csdn.net/polisan/article/details/5031142
相关文章推荐
- gcc __attribute__关键字举例之constructor/destructor
- GCC中 __attribute__((constructor)|(destructor))
- GCC __attribute__((constructor)|(destructor))
- GCC的__attribute__ ((constructor))和__attribute__ ((destructor))
- gcc的__attribute__ ((constructor))和__attribute__ ((destructor))
- GCC __attribute__((constructor)|(destructor))
- gcc下__attribute__ ((constructor))和__attribute__ ((destructor))的使用
- GCC __attribute__((constructor)|(destructor))
- gcc下__attribute__ ((constructor))和__attribute__ ((destructor))的使用
- GCC的__attribute__ ((constructor))和__attribute__ ((destructor))
- GCC __attribute__((constructor)|(destructor))
- GCC设置函数属性为constructor和destructor
- gcc中的constructor属性和destructor属性
- GNU C - 一个别致的HelloWorld程序 引申到: __attribute__((constructor)|(destructor)(PRIORITY))
- 函数属性__attribute__((constructor))和__attribute__((destructor))
- 关于GCC的__attribute__ ((constructor))
- __attribute__((constructor)) && __attribute__((destructor))
- __attribute__中constructor和destructor
- 关于GCC的__attribute__(constructor)
- GNU C - 一个别致的HelloWorld程序 引申到: __attribute__((constructor)|(destructor)(PRIORITY))