Geminias @ Wed Aug 08, 2007 6:44 am wrote:
I'm mainly interested in __init because I've never seen syntax like:
storage_class return_type macro function()
Nothing special... the macro could have been an obfuscated part of the return type like "unsigned". What you probably want to know if what the GNU extension for function attributes is. __attribute__((__section__(".init.text") )) causes the function to go into a special section of the compiled object. The linker puts it into some (I guess special) segment, and the loader does something special with it so that you get the behaviour you described. So go hunt down what .init.text is.
Quote:
I also I don't really know what static does. I think it is different from the C++ static keyword... right?
Well, C++ lets you use "static" this way too. It makes it so that the function can only be referenced by name in this source file. Other source files can have functions of the same name, but they won't be this function. It affects the linkage of the function.