RE: c++ in kernel

From: Kneemeyer, Ralf (ralf_kneemeyer@digi.com)
Date: Mon Apr 03 2000 - 06:15:53 EST


Hi,

I tried some things with c++ modules.
I used a dummy called cplusplus.cc (for g++) with init_/cleanup_module.
The complete source was extern "C"ed.
When insmoding with -f and compiled w & w/o MODVERSIONS insmod
said "c++_cc.o: couldn't find the kernel version the module was compiled
for"
The same source called cplusplus.c (for gcc) loaded w/o trouble.

rgds
Ralf Kneemeyer

> -----Original Message-----
> From: Nicholas Vinen [mailto:hb@sonique.com]
> Sent: Tuesday, March 21, 2000 2:40 PM
> To: Manfred Spraul
> Cc: Kneemeyer, Ralf; Linux-Kernel (E-Mail)
> Subject: Re: c++ in kernel
>
>
>
> You'd need to do something like this:
>
> extern "C" {
> #include <allkernelheaders.h>
> }
>
> You'd also have to extern "C" all symbols exported back to
> the kernel
> unless you do it explicitly. And any callback functions would
> need to be
> either global, static or class-static.
>
> Nicholas Vinen
>
> ---
>
> "... one of the main causes of the fall of the Roman Empire was that,
> lacking zero, they had no way to indicate successful termination of
> their C programs."
> -- Robert Firth
>
>
> On Tue, 21 Mar 2000, Manfred Spraul wrote:
>
> > From: "Kneemeyer, Ralf" <ralf_kneemeyer@digi.com>
> > >
> > > In my tests I wasn't even able to insmod a simple module
> > > without c++ source, just with g++ compiled ( source.cc ).
> > >
> > That _should_ be possible, although I never tried that:
> >
> > * did you surround all #include lines with 'extern "C" '?
> > * did you disable all fancy C++ features? exception
> handling, RTTI, perhaps
> > you must supply your own "new" and "delete".
> >
> > c++ modules might be a topic for 2.5 [i.e. add CPPFLAGS to
> Rules.make, and
> > add the "extern "C"" in all header files.]
> >
> > what was the exact error message from insmod?
> >
> > --
> > Manfred
> >
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in
> > the body of a message to majordomo@vger.rutgers.edu
> > Please read the FAQ at http://www.tux.org/lkml/
> >
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

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



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:09 EST