__ attribute __((constructor)): 在main函数被调用之前调用
注:调用之前,各个全局变量已经完成初始化。也就是说,这些函数是在全局变量初始化之后,main函数之前调用的。这一点是非常重要的,否则可能会引起很多的问题。
__ attribute __((destructor)): 在main函数被调用之后调用
例子
__ attribute __((constructor)): 在main函数被调用之前调用
注:调用之前,各个全局变量已经完成初始化。也就是说,这些函数是在全局变量初始化之后,main函数之前调用的。这一点是非常重要的,否则可能会引起很多的问题。
__ attribute __((destructor)): 在main函数被调用之后调用
例子
近期评论