|
if malloc and remalloc are on a boat... |
Thomas Fjellstrom
Member #476
June 2000
|
hmmm... void my_function(); //whatever this does class __call_before_main { public:__call_before_main ( void (*func)()) {func();} }; #define CALL_BEFORE_MAIN(a) static __call_before_main __call_ ## a ( a ) ; CALL_BEFORE_MAIN(my_function); is not equivelent to: void __attribute__((constructor)) my_function() { } thats 'GCC C' but Im sure thiers methods for other compilers, that I don't use... And with some nice defines like yours above it can be just as compiler independent. (unless of course your compiler uses a #pragma directive to set a constructor) -- |
Bob
Free Market Evangelist
September 2000
|
You can use _Pragma in that case #define FOO(bar) _Pragma blah(bar)
-- |
|
|