From owner-freebsd-hackers Tue Nov 24 11:47:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA28792 for freebsd-hackers-outgoing; Tue, 24 Nov 1998 11:47:57 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA28782 for ; Tue, 24 Nov 1998 11:47:55 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id LAA02152; Tue, 24 Nov 1998 11:47:53 -0800 (PST) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.1/8.9.1) id LAA00814; Tue, 24 Nov 1998 11:47:52 -0800 (PST) (envelope-from jdp@polstra.com) Date: Tue, 24 Nov 1998 11:47:52 -0800 (PST) Message-Id: <199811241947.LAA00814@vashon.polstra.com> To: jagapen@whitewater.chem.wisc.edu Subject: Re: ELF Global Constructors Newsgroups: polstra.freebsd.hackers In-Reply-To: Organization: Polstra & Co., Seattle, WA Cc: hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article , Jonathan Gapen wrote: > I'm in the process of porting GNUstep to FreeBSD 3.0, and I've run > into a lack of documentation. Consequently, I don't know where the > problem lies. It's like this: > GNUstep needs to have a function _gnu_process_args() called before > main() to set up information about the process for use by the Foundation > library. Check out the gcc info pages, in the section "Function Attributes". Here's the section of interest: `constructor' `destructor' The `constructor' attribute causes the function to be called automatically before execution enters `main ()'. Similarly, the `destructor' attribute causes the function to be called automatically after `main ()' has completed or `exit ()' has been called. Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program. It does go on to say this, though, so you'll have to use C: These attributes are not currently implemented for Objective C. Anyway, it should work for C if you add "__attribute__ ((constructor))" at the end of the function declaration. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message