C ++ support in the kernel module on a 64-bit system

I know that C ++ is not recommended in the kernel module, however we have a module written in a combination of C and C ++ files, this module works well in a 32-bit system (2.6 kernel), now we are trying to connect the module in 64 -bit system, C ++ is not supported at all on a 64-bit system?

+4
source share
2 answers

It’s not a question of whether the language is supported in a 64-bit language, but whether libraries and other code are portable.

+2
source

Roughly speaking, to use C ++ in the kernel, you must get rid of all the dependencies of the C ++ library at runtime, first of all, you must override new/delete and remove the exception handling (compiled with -fno-exceptions ). In fact, if 32-bit code works, these simple cases should already be resolved.

Just try compiling and loading the module. If you are lucky, there will be no communication errors, and you will have a good chance for the module to work (compared to the usual set of cross-platform issues, such as the size and alignment of the structure). If you do not, you will receive a list of undefined characters that will give you a hint about what should be implemented or worked out.

+2
source

All Articles