Linux kernel is written in C (and in Assembly in platform-specific portions) language. C language is only one allowed language to write kernel modules. And there is no problem, in most of the cases. But sometimes some stranger things may be required. Let’s see how to use C++ for the Linux kernel modules.
In this little note, I wanna describe a simple logging module for C programs in Linux. I’m using this code for years in my projects. This module supports different types of output “targets” – files, syslog, and stdout.