External argc and argv

Joe Buck jbuck@Synopsys.COM
Mon Mar 8 18:59:00 GMT 1999


> 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.



More information about the Gcc mailing list