[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux kernel modules development in C++
=?iso-8859-1?Q?Abel_Mu=F1oz_Alcaraz?= <> said:

> I want to develop a linux kernel module in C++ but I don't find
> makefiles and/or sorce files examples to do this.

Your problem is that you can't use anything of C++ that needs runtime
support inside the kernel (there goes new() and friends), exception
handling is out of the question (bye, bye, throw() et al), and (in case you
hadn't thought of it) libstdc++ is way out of line (no fancy data
structures or algorithms). What is left is not very much... and it won't
make much of a difference in a driver, which by its nature is typically
smallish. You have no place to go to find stuff you could inherit from, so
you'd have to recreate all the supporting object infrastructure in the
kernel in C++, or port it somehow from C (the object model inside the
kernel doesn't really map into C++'s concepts cleanly!). Not worth the
effort, AFAIKS.

The kernel is written in plain gcc C (this is _not_ your ANSI C!), it uses
identifiers that are reserved words in C++. And that won't change anytime
very soon. But that would get you only to the point of using C++'s
procedural aspects. To make it really worthwhile to write parts of the
kernel in C++, the kernel would have to be redesigned from the ground up
for C++. Nobody has ever volunteered (or even just hinted that they could
be persuaded to volunteer) to do this job, and this discussion comes up
each four months or so.
Dr. Horst H. von Brand
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.102 / U:5.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site