On 06/28/2010 04:19 PM, Sébastien Lorquet wrote:
Hi,
If I understand correctly, this is the same type of idea of the linux kernel's __init magic, except that no code cleanup is done?
AFAIK it is the same type of idea but implemented in a different way: the linux kernel uses several (self-defined) sections, see http://lxr.free-electrons.com/source/include/linux/init.h lines 170ff. (and 187ff.)
#define __define_initcall(level,fn,id) \ static initcall_t __initcall_##fn##id __used \ __attribute__((__section__(".initcall" level ".init"))) = fn
to define the init functions and the order they should be called in.
Cheers, Jörg.