From owner-freebsd-questions Sat Mar 2 9:47:32 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail8.nc.rr.com (fe8.southeast.rr.com [24.93.67.55]) by hub.freebsd.org (Postfix) with ESMTP id E620E37B41A; Sat, 2 Mar 2002 09:47:24 -0800 (PST) Received: from i8k.babbleon.org ([66.57.85.154]) by mail8.nc.rr.com with Microsoft SMTPSVC(5.5.1877.687.68); Sat, 2 Mar 2002 09:46:55 -0500 Received: by i8k.babbleon.org (Postfix, from userid 111) id DE38CBA03; Sat, 2 Mar 2002 09:41:15 -0500 (EST) Content-Type: text/plain; charset="iso-8859-1" From: Brian T.Schellenberger To: Aleksander Rozman - Andy , freebsd-hackers@FreeBSD.ORG Subject: Re: How to write code in FreeBSD Date: Sat, 2 Mar 2002 09:41:15 -0500 X-Mailer: KMail [version 1.3] Cc: freebsd-questions@FreeBSD.ORG References: <5.0.2.1.0.20020302125303.02c1ca90@164.8.8.5> In-Reply-To: <5.0.2.1.0.20020302125303.02c1ca90@164.8.8.5> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20020302144115.DE38CBA03@i8k.babbleon.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Saturday 02 March 2002 06:57 am, Aleksander Rozman - Andy wrote: > Hi ! > > I was wondering if there are any guidelines how to write code in FreeBSD. I > have taken a look at several code of FreeBSD but each is written > differently? Problem is I don't know which is preferred way. > > Reason I am asking this is that I am trying to add some code to kernel. > Compile is OK, no error, no warning, but on link all variables defined with > extern are marked as : undefined reference to 'variable', variable is > extern and .h file which has it defined is included... Where can be the > problem?? Another problem is that I get multiple definition error...how can > I get over this. There's notthing "special" about FreeBSD in this regard. You have to have *some* file which does *not* refer to the variables as "extern" since "extern" means "defined someplace else in the link," and if *every* file says tha they are defined in some *other* file, well, then, they never get defined--just declared. THis is a basic "C" quesiton, not a "FreeBSD" question. -- Brian T. Schellenberger . . . . . . . bts@wnt.sas.com (work) Brian, the man from Babble-On . . . . bts@babbleon.org (personal) ME --> http://www.babbleon.org http://www.eff.org <-- GOOD GUYS --> http://www.programming-freedom.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message