Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 2003 18:53:48 -0600
From:      John Giacomoni <John.Giacomoni@colorado.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Basic C++ fBSD 5.x kernel module
Message-ID:  <3CF46700-E329-11D7-B54C-0003930719D8@colorado.edu>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CF46700-E329-11D7-B54C-0003930719D8>