Re: argv
- From: Enno Borgsteede <ennoborg gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: argv
- Date: Sat, 16 Apr 2016 22:47:01 +0200
Andrew,
In reality, this is what it actually is:
1) Argc and argv are initially processed only by the OS, and never by the
linker or GTK or any compiler until after main() is called. Nothing you can do
with the linker, GTK, or the compiler can change that fact.
Not true. The program arguments are supplied by the OS, but not
necessarily as argc and argv. In a C program, they are prepared by the
init part of the run time library, which is linked against the main
program. That init part makes sure that argc and argv etc. are passed in
a format that main understands. Check
http://stackoverflow.com/questions/3469955/in-c-how-is-the-main-method-initially-called
and
http://dbp-consulting.com/tutorials/debugging/linuxProgramStartup.html
which is the URL shown in the best answer.
2) Assemblers don't have their own calling conventions. OSes have their own
calling conventions and you pick a compiler with the same calling convention,
or you hand program yourself, or your program will never work.
OSes have calling conventions of their own, but compilers and languages
have them too. A Pascal compiler passes strings in another way than a C
compiler does.
When you write in assembler, and don't use the C startup libraries, you
will get the program arguments and environment in the format supplied by
the OS, or more exact the OS's program loader.
regards,
Enno
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]