Hi

I think this dicusion is going a litle bit abstruse. The stl, glibc, e.c are 
not indent to be used in kernel space, and i think that this is not only 
because it takes 16 megs to do it. The division in kernel- and user-space has 
it's purpose and it is in allmost all times a sign for bad design if you need 
to do such hacks. In kernel-space thinks should be small, fast and stable. 
(no some calls result in kernel-panic situations!!!). This is what makes a 
system buggy (and work in an MS manner).
I think if your code went to complicated to be coded in pure C it is not a 
problem to be solved in kernel-space.
BTW good C-code looks to me like a poem and i like poems. So why not writing 
more poems :-)
I use C++ for myself in many cases, but in my opinion in kernel-space it has 
no legitimation.

-- 
Tsch��

Ulf

=================
Ulf Bestmann
[EMAIL PROTECTED]
=================

> Hi -- yes, you can do C++ in kernel. Infact, I have put all of
> STL, libC, and libm, libtiff and libz.a all into the kernel. Granted, it
> is the mother of all modules -- about 16 MB in our case.
>
>       There are a couple of things you need to do. First, you need a
> "static" built version of g++ and C++ libs must be static -- i.e., if you
> "nm" a library, you should not see the GLOBAL_OFFSET_TABLE (sp?) symbol
> anywhere. You will need to hack the GCC makefiles by hand to really get a
> true static version of g++.
>
>       Next, you need to build your C++ system statically, but make sure
> you build it into a single object file. This can be done using:
>
>               ld -r LIST_OF_OBJ_FILES -o stage1.o
>
>       Finally, link your single object file against the systems
> libraries by doing:
>
>       ld -r stage1.o LIST_OF_STATIC_LIBRARIES -o final_module.o
>
>       Then just do:
>
>       insmod final_module.o
>
>       Note, you could smash all the objects and libs into a single
> final_module.o, but most folks makefiles do this separately..
>
>       Overall, GNU "ld" is a really powerful linker.
>
>       The limitation found thus far are your "cout" and "cin" statement
> do not appear, also most of the system calls will result in either a
> module failure or kernel panic, so stay away from file I/O, sockets, etc.
>
>       But specific C++ features, like exceptions do appear to work.. I
> hope this is useful...
>
>                       Regards,
>                       Chris
>
> --------------------------------------------------------------------
> Christopher D. Carothers
>
> Assistant Professor
> Department of Computer Science
> Rensselaer Polytechnic Institute
> 110 8th Street
> Troy, New York 12180-3590
>
> e-mail: [EMAIL PROTECTED]
> web page: www.cs.rpi.edu/~chrisc
> phone: (518) 276-2930
> fax: (518) 276-4033
> --------------------------------------------------------------------
>
> On Tue, 19 Mar 2002 [EMAIL PROTECTED] wrote:
> > In kernel space everything you do must be thought through.
> > I would have thought new and delete would not be allowed (or exist).
> > There would be special alternatives.
> > This leads to the question is C++ possible in kernel space?
> >
> > Karl.
> >
> >
> >
> >
> > [EMAIL PROTECTED] (Steven Seeger)@rtlinux.org on 18/03/2002 22:55:36
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > Sent by:    [EMAIL PROTECTED]
> >
> >
> > To:    [EMAIL PROTECTED]
> > cc:
> > Subject:    RE: [rtl] (RT) C++ why you should use it
> >
> >
> > Karl,
> >
> > Are new and delete even safe to use in kernel space? Come to think of it,
> > I never actually tried.
> >
> > Steve
> >
> > >-----Original Message-----
> > >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > >[EMAIL PROTECTED]
> > >Sent: Sunday, March 17, 2002 3:59 AM
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: [rtl] (RT) C++ why you should use it
> > >
> > >
> > >C++ has its places, especially where inheritance fits well,
> > >and GUI is the
> > >best example for the use of inheritance.
> > >For more procedure stuff like the kernel or device driving then C works
> > >well.
> > >Remember there are more mundane features of OO like grouping
> > >procedures and
> > >data into packages which can be done with any language though
> > >C++ provides
> > >one with features to do it and control it.
> > >
> > >One danger I see with using C++ is that using RTLinux implies one wants
> > >control over what happens especially with predictable timing. What a
> > >compiler does with C++, especially dynamic calling, creation
> > >and deletion
> > >of objects and memory allocation  and worse of all memory
> > >deallocation may
> > >mean one loses control.
> > >
> > >Karl.
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/
> >
> >
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> > echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/
>
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
> echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to