From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 9 17:53:52 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 221F716A4BF for ; Tue, 9 Sep 2003 17:53:52 -0700 (PDT) Received: from serl.cs.colorado.edu (serl-fs.cs.colorado.edu [128.138.242.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B24943FF3 for ; Tue, 9 Sep 2003 17:53:49 -0700 (PDT) (envelope-from John.Giacomoni@colorado.edu) Received: from colorado.edu (serl.cs.colorado.edu [128.138.242.65]) by serl.cs.colorado.edu (8.12.9/8.12.6) with ESMTP id h8A0rmiQ003464 for ; Tue, 9 Sep 2003 18:53:48 -0600 (MDT) Date: Tue, 9 Sep 2003 18:53:48 -0600 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; charset=US-ASCII; format=flowed From: John Giacomoni To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <3CF46700-E329-11D7-B54C-0003930719D8@colorado.edu> X-Mailer: Apple Mail (2.552) Subject: Basic C++ fBSD 5.x kernel module X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2003 00:53:52 -0000 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