Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 11:47:52 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        jagapen@whitewater.chem.wisc.edu
Cc:        hackers@FreeBSD.ORG
Subject:   Re: ELF Global Constructors
Message-ID:  <199811241947.LAA00814@vashon.polstra.com>
In-Reply-To: <Pine.NXT.4.05.9811190119410.973-100000@swamp>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.NXT.4.05.9811190119410.973-100000@swamp>,
Jonathan Gapen  <jagapen@whitewater.chem.wisc.edu> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811241947.LAA00814>