Query about cplusplus in linkage.h

rocky bill_carson at 126.com
Fri Nov 19 23:17:02 EST 2010


Hi, all

I am a little confused about the following definition :

--------------include/linux/linkage.h-----------
#ifdef __cplusplus
#define CPP_ASMLINKAGE extern "C"
#else
#define CPP_ASMLINKAGE
#endif

#ifndef asmlinkage
#define asmlinkage CPP_ASMLINKAGE
#endif

all system call functions are marked with asmlinkage, as well as other kernel function like printk/schedule/do_softirq


so every asmlinkage function has extern "C"  attribute if cplusplus is defined, which definitely happens  when compiling C++ code.

I dont get it when cplusplus is needed when compiling kernel?

Can anyone help me out of this little misunderstanding?

Thansk




		



More information about the linux-arm-kernel mailing list