Skip to content

veltzer/kcpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Apr 1, 2025
46a230c · Apr 1, 2025
Aug 29, 2024
Mar 24, 2025
Dec 7, 2024
Oct 13, 2023
Aug 30, 2020
Apr 6, 2024
Mar 21, 2025
May 9, 2022
Mar 23, 2025
Oct 12, 2023
Oct 3, 2024
Jan 20, 2025
Aug 22, 2024
Oct 17, 2016
Jul 14, 2014
Jul 14, 2014
Aug 28, 2015
Jun 23, 2013
Apr 7, 2024
Apr 1, 2025
Jul 14, 2014
Aug 10, 2016
Aug 10, 2016
Jun 23, 2013
Jul 14, 2014

Repository files navigation

kcpp

version: 0.0.1

description: C++ framework for the linux kernel

website: https://veltzer.github.io/kcpp

Build

build

Contact

chat with me at gitter

POC for writing C++ modules for the Linux kernel

C++ has lots of issues which are not dealt with in the kernel.

  • Problems in linking.

  • Exception handling that needs to be turned off.

  • Memory management functions (like new and delete) which need to be implemented.

  • The kernel headers are not suitable for inclusion for a C++ compiler since they conflict with many C++ constructs ('class' for instance and more).

  • The kernel build system does not compile C++ correctly, or even at all.

  • separate the "top part" - the one that is getting called by Linux, like driver entry and exit points, interrupt functions, tasklets, whatever and handle them in a C layer. expose APIs for all of these facilities and other low level facilities (printk, hardware access and more) via C functions.

  • write a top part that only accesses these services by well controlled C functions which do not include the kernel headers and are C++ friendly. In the top part write a framework for device driver writing based on OO concepts (inherit from Device and implement the relevant methods).

  • Add ability to include header files directly in C++ code. Progress: have 'copy_headers' target in makefile which also applies patch but headers are still hard to work with... This is to be developed as a patch to the linux kernel (big project - watch out! may never happen...)

  • add a framework for writing char drivers

  • http://code.google.com/p/kernelcpp/ They do not have a buffer layer but instead do "extern C" before kernel headers. Try to see if this works for a big example. They have all kinds of other ideas about constructors for global object and so on.

  • http://www.drdobbs.com/cpp/c-exceptions-the-linux-kernel/229100146

Mark Veltzer, Copyright © 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025