Basic C++ fBSD 5.x kernel module

John Giacomoni John.Giacomoni at colorado.edu
Tue Sep 9 17:53:52 PDT 2003


I have succeeded in getting a basic C++ module to function inside the
FreeBSD 5.1 kernel.

I figured I'd show the small example I have cooked up which uses basic
C++ constructs such a new/delete and virtual inheritance.

As suggested I have turned off exceptions have been turned off along 
with
RTTI.

the source and Makefile can be found at:
http://www.cs.colorado.edu/~jgiacomo/fbsd_c++module

Things to note are:
a) I rolled my own .cc.o extension to the Makefile
    removed -std=c99
    added -fno-exceptions -fno-rtti -fno-builtin -nostdinc++
    (-fno-builtin should be implied by -ffreestanding but does not seem 
to be)

b) __unused does not seem to work and needed to be #undef'ed
    * Any thoughts?

c) Constructs of the form "static void const * const" seem to be
    silently ignored by the compiler.  Possibly being 'inlined' in some 
fashion?
    * Any thoughts?

part is 'c' is problem as various macros, such as MALLOC_DEFINE and
DEV_MODULE, use that construct for initialization.

thoughts? comments?  suggestions?

John G



More information about the freebsd-hackers mailing list