[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux kernel modules development in C++
** Reply to message from "Richard B. Johnson" <> on Wed,
27 Sep 2000 15:13:45 -0400 (EDT)

> > I want to develop a linux kernel module in C++ but I don't find
> > makefiles and/or sorce files examples to do this.
> >
> Use the correct tool for the job. The Linux kernel uses 'C' and assembly.

Well, that's not much of answer. It certainly doesn't mean anything to people
who have port drivers with tens of thousands of lines of code, all in C++.

I haven't tried C++ in Linux drivers myself, but I assume it can't be any more
difficult than what I had to do for OS/2. Five years ago (imagine that - OS/2
is years ahead of Linux in this regard), I hacked up a method for getting C++
code to compile into an OS/2 device driver. I had to write some extra code,
but it was really no problem.
Sure, I couldn't use exception handlers, but so what? All I needed to do was
define malloc() and free(), and I could create and destroy objects whenever I
wanted. In fact, you don't even need malloc() and free() - the C++ language
allows you to redined new and delete on a per-class basis.

Then I created some stub functions that would normally be called under an error
condition (like a missing virtual method in a subclass). In fact, the linker
did all the work in this case - when I tried to link my driver with no runtime,
it gave me a nice list of missing functions, and all I had to do was create
stubs for them.

Timur Tabi -
Interactive Silicon -

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
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:39    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean