From owner-freebsd-hackers Tue Nov 14 9:57:54 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from hda.hda.com (host65.hda.com [63.104.68.65]) by hub.freebsd.org (Postfix) with ESMTP id 8ED0137B4FE for ; Tue, 14 Nov 2000 09:57:51 -0800 (PST) Received: (from dufault@localhost) by hda.hda.com (8.9.3/8.9.3) id NAA99016; Tue, 14 Nov 2000 13:02:57 -0500 (EST) (envelope-from dufault) From: Peter Dufault Message-Id: <200011141802.NAA99016@hda.hda.com> Subject: Re: C and C++ on FreeBSD In-Reply-To: <200011141741.KAA48265@harmony.village.org> from Warner Losh at "Nov 14, 2000 10:41:13 am" To: freebsd-hackers@FreeBSD.ORG Date: Tue, 14 Nov 2000 13:02:57 -0500 (EST) Cc: tjmsdn@ifrance.com X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > In message <00111412240100.00321@tjonas_dev.eicon.com> Thierry writes: > : We are implementing our OS modem on FreeBSD, but lot of our sources > : have writen in C++. Is it possible to compile the FreeBSD kernel in > : C++ to include our driver ? > > Yes and No. > > If you use only the bare minimal subset of features for the C++ and > avoid the problem areas of the language, you might be able to. But > you'd have to add new and delete support to the kernel's library. > That should be almost trivial. > > The problem areas definitely include exceptions, some automatic memory > allocation (where temporary variables are malloced), large objects > appearing on the stack (because the kernel stack is so small). I > don't know if ctors for static objects would be called in the kernel. > Templates might also be a problem, but they might not. I'll second the "doability" of this. I've been going through some C++ work in an embedded system. Exceptions had already been given up on. The ctors/dtors are handled with "munch" style tools (from vxWorks land) that generate construct/destruct vectors that you'll probably then hook in with kernel modules. Peter -- Peter Dufault (dufault@hda.com) Realtime development, Machine control, HD Associates, Inc. Fail-Safe systems, Agency approval To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message