lkml.org 
[lkml]   [2004]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Compiling C++ kernel module + Makefile


    On Mon, 19 Jan 2004, Bart Samwel wrote:

    > But we're not talking about the base kernel here. We're not talking
    > about migrating the kernel to C++, or even modules that are part of the
    > Linux kernel source. We're talking about *independent modules*. The
    > kernel exports a module interface, and any binary driver that correctly
    > hooks into the interface of the running kernel (using the correct
    > calling conventions of the running kernel) and behaves properly (e.g.,
    > doesn't do stack unwinds over chunks of kernel functions etc.) can hook
    > into it and do useful work. If somebody has decided that it would be
    > worth it for his project to use C++ (without exceptions, rtti and the
    > whole shebang) then so be it, why should you care? It's just binary code
    > that hooks into the module interface, using the correct calling
    > conventions. It doesn't do dirty stuff -- no exceptions, no RTTI,
    > etcetera. It compiles into plain, module-interface conforming assembler,
    > that can be compiled with -- you guessed it -- 'as', the AT&T syntax
    > assembler. Yes, they're taking a risk. Their risk is that C++ can't
    > import the kernel headers, or that C++ might someday need runtime
    > support that cannot be ported into the kernel.

    I managed to use a a lot of C++ code in a kernel modules. I used wrapper
    functions to pass data between C and C++ parts. C++ code had no exceptions
    and such thing, but I had to play some dirty tricks anyway because C++
    code needs stuff which is provided by userpace libraries to run.
    Maybe the right solution is writing a module that provides a fast data
    path between the kernel and the userspace router.


    --
    Giuliano.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:00    [W:0.019 / U:12.780 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site