This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: External argc and argv
- To: chadg at redrose dot net (Chad Gatesman)
- Subject: Re: External argc and argv
- From: Joe Buck <jbuck at Synopsys dot COM>
- Date: Mon, 8 Mar 99 18:59:10 PST
- Cc: egcs at cygnus dot com
> I need to be able to access argc and argv within a static constructor.
> The way to do this would be to access external global declarations of
> argc and argv. This is usually different for each platform. For
> example, on Digital UNIX and Irix (using their native compilers) they
> provide __Argc and __Argv.
>
> From what I can see, egcs does not provide such a thing.
egcs cannot, since the code that creates argc and argv is provided by
the OS vendor, not by egcs.
> make any suggestions for me, or know of a way of accessing argc and argv
> within a static constructor (constructs a static global object before
> even getting to main())?
There is no portable way to do the job. You might be able to do it on
an OS-specific basis, but the code will have to be different for each
platform.