Monday, January 10, 2011

call a function before main

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
__attribute__((constructor))


for GCC on Solaris
#pragma init
http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Solaris-Pragmas.html#Solaris-Pragmas


如果是c++的話
當然 最簡單的就是在global scope定義一個object(或new)

No comments: