External argc and argv
Chad Gatesman
chadg@redrose.net
Mon Mar 8 19:09:00 GMT 1999
Joe Buck wrote:
> > 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.
I was not aware of that fact.
> > 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.
I am aware it will be OS specific. I have it set up for 10 platforms right
now, and I'm looking to do this with Linux on Intel x86. So I guess my
question is, how can I do this on Linux for Intel x86?
Chad Gatesman
More information about the Gcc
mailing list