lkml.org 
[lkml]   [2008]   [Feb]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 11 Feb 2008 17:07:49 +0530
From"rohit h" <>
SubjectRe: [LINUX-KERNEL] C++ in linux kernel
On Feb 8, 2008 9:24 PM, Jan Engelhardt <jengelh@computergmbh.de> wrote:
>
> On Feb 9 2008 00:14, Joonwoo Park wrote:
> >2008/2/8, rohit h <hrohit85@gmail.com>:
> >> Hi,
> >>  I am a kernel newbie.
> >>  I tried to insmod a C++ module containing classes, inheritance.
> >>  I am getting 'unresolved symbol' error when I use the 'new' keyword.
> >>  What could the problem be?
> >>
> >>  What kind of runtime support is needed ( arm linux kernel)? Is a
> >> patch available for it?
> >>
> >Please take a look at click modular router which is using c++ as a
> >linux kernel module.
> >http://www.read.cs.ucla.edu/click/
> >The lib/glue.cc provides custom operator new.
>
> Uh, let's not make the world worse :)
> Just call malloc from C++, and carefully select what C++ features
> you are going to use. The VMware source for example does it right.
>

From the links given, I dig that following C++ features need runtime support:
   a. Pure virtual functions
   b. Global objects  : Needs compiler dependent changes
   c. new & delete : Can use kmalloc / kfree instead
   d. Run time type info
   e. Exceptions
I guess features d & e need considerable effort.
Apart from these, am I free to use other C++ features?
Where could I see the VMWare sources?


> Compiling the kernel module with g++ is not a simple work, you may
> need big patch for kernel itself.

I don't want to compile entire kernel.
I only want to compile my module with g++ and insmod it.
Any hint on how to write the Makefile.

Thanks in advance,
Rohit
--
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: 2008-02-11 12:41    [from the cache]
©2003-2008