Skip to content

Latest commit

 

History

208 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kcpp

version: 0.0.1

description: C++ framework for the linux kernel

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

Build

build

POC for writing C++ modules for the Linux kernel

The problem:

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.

The idea:

  • 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).

Future ideas:

  • 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

Related projects:

Contact

chat with me at gitter

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

About

C++ framework for the linux kernel

Topics

Resources

Stars

33 stars

Watchers

4 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages