From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 8 19:46:16 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 29B9A16A4BF for ; Mon, 8 Sep 2003 19:46:16 -0700 (PDT) Received: from mx7.mail.ru (mx7.mail.ru [194.67.23.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FD1143FBD for ; Mon, 8 Sep 2003 19:46:15 -0700 (PDT) (envelope-from kabaev@mail.ru) Received: from [151.203.230.77] (port=49283 helo=kan.dnsalias.net) by mx7.mail.ru with esmtp id 19wYWH-000HPX-00; Tue, 09 Sep 2003 06:46:17 +0400 Received: from kan.dnsalias.net (ak03@localhost [127.0.0.1]) by kan.dnsalias.net (8.12.9/8.12.9) with ESMTP id h892kCk2005677; Mon, 8 Sep 2003 22:46:12 -0400 (EDT) (envelope-from kan@kan.dnsalias.net) Received: (from kan@localhost) by kan.dnsalias.net (8.12.9/8.12.9/Submit) id h892kB2A005676; Mon, 8 Sep 2003 22:46:11 -0400 (EDT) Date: Mon, 8 Sep 2003 22:46:11 -0400 From: Alexander Kabaev To: John Giacomoni Message-Id: <20030908224611.06027082.kabaev@mail.ru> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.4claws33 (GTK+ 1.2.10; i386-portbld-freebsd5.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: Not detected cc: freebsd-hackers@freebsd.org Subject: Re: C++ code in a 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: Tue, 09 Sep 2003 02:46:16 -0000 On Mon, 8 Sep 2003 11:35:37 -0600 John Giacomoni wrote: > I was planning on using the macro __cplusplus to toggle using > extern "C" { }, however the bsd.kmod.mk style Makefiles seem to > force the language to -std=c99 even when compiling with c++ . > > my initial steps have been as follows: > take a functioning C based kernel module and rename to .cc > added extern "C" around the includes. > #defined key words such as new to xxx_new > recompiled the new .cc file by hand without -std=c99, but > keeping all the flags as the Makefile set them. > then linked using the Makefile and finally loaded the module. -fno-rtti -fno-exceptions is probably a must unless you want to bring a whole libsupc++ library into the kernel. -- Alexander Kabaev