I want to know about C-startup Routine contents and its modification

Discussion in 'C Programming' started by Ramaraj, Oct 20, 2003.

  1. Ramaraj

    Ramaraj Guest

    Hi All,

    I am very interest to know the c-startup routine (like GNU gcc C-startup
    routine). and it s working principle and How this function is attached to
    operating system


    Thanks in adavance.

    with regards
    Ramaraj
    Ramaraj, Oct 20, 2003
    #1
    1. Advertising

  2. Ramaraj

    Morris Dovey Guest

    Re: [OT] C-startup Routine

    Ramaraj wrote:

    > I am very interest to know the c-startup routine (like GNU gcc
    > C-startup routine). and it s working principle and How this
    > function is attached to operating system


    Ramaraj...

    The startup function is platform/implementation specific and not
    a standardized part of the C language. Why not take a look at the
    compiler and library documentation?

    For gcc, you can actually look at the source code and answer your
    own question more quickly than anyone here could provide you with
    a complete answer.
    --
    Morris Dovey
    West Des Moines, Iowa USA
    C links at http://www.iedu.com/c
    Morris Dovey, Oct 20, 2003
    #2
    1. Advertising

  3. Ramaraj

    Dan Pop Guest

    Re: [OT] C-startup Routine

    In <QDOkb.615$> Morris Dovey <> writes:

    >Ramaraj wrote:
    >
    >> I am very interest to know the c-startup routine (like GNU gcc
    >> C-startup routine). and it s working principle and How this
    >> function is attached to operating system

    >
    >Ramaraj...
    >
    >The startup function is platform/implementation specific and not
    >a standardized part of the C language. Why not take a look at the
    >compiler and library documentation?


    In my experience, people asking this kind of questions should better
    spend their time actually learning C. By the time you actually understand
    what really C is about, the interest for such issues is very likely to
    vanish: as a C programmer, you couldn't care less.

    By the time you're confronted with writing a C startup module yourself,
    you have enough clues to realise that c.l.c is one of the last newsgroups
    to ask for help.

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
    Dan Pop, Oct 20, 2003
    #3
  4. Ramaraj

    Morris Dovey Guest

    Re: [OT] C-startup Routine

    Dan Pop wrote:
    > In <QDOkb.615$> Morris Dovey
    > <> writes:
    >
    >> Ramaraj wrote:
    >>
    >>> I am very interest to know the c-startup routine (like GNU
    >>> gcc C-startup routine). and it s working principle and How
    >>> this function is attached to operating system

    >>
    >> Ramaraj...
    >>
    >> The startup function is platform/implementation specific and
    >> not a standardized part of the C language. Why not take a
    >> look at the compiler and library documentation?

    >
    > In my experience, people asking this kind of questions should
    > better spend their time actually learning C. By the time you
    > actually understand what really C is about, the interest for
    > such issues is very likely to vanish: as a C programmer, you
    > couldn't care less.


    True - except that at one point I found myself writing a startup
    function for an embedded system (along with the code to produce
    argc and argv along with a split 'shell', half of which ran on an
    NT system and half on the SoC under test).

    > By the time you're confronted with writing a C startup module
    > yourself, you have enough clues to realise that c.l.c is one
    > of the last newsgroups to ask for help.


    /Usually/ true. I didn't search to see if Ramaraj is new to c.l.c
    - I just assumed that he found himself in a situation similar to
    that described above. Note that /I/ didn't bring my issue to
    c.l.c - although I did e-mail a c.l.c regular (after consulting
    several of my favorite search engines) to ask if he was aware of
    any available solutions to a related device usage problem.
    --
    Morris Dovey
    West Des Moines, Iowa USA
    C links at http://www.iedu.com/c
    Morris Dovey, Oct 21, 2003
    #4
  5. Ramaraj

    Dan Pop Guest

    Re: [OT] C-startup Routine

    In <GY%kb.143$> Morris Dovey <> writes:

    >Dan Pop wrote:
    >> In <QDOkb.615$> Morris Dovey
    >> <> writes:
    >>
    >>> Ramaraj wrote:
    >>>
    >>>> I am very interest to know the c-startup routine (like GNU
    >>>> gcc C-startup routine). and it s working principle and How
    >>>> this function is attached to operating system ^^^
    >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    >>> Ramaraj...
    >>>
    >>> The startup function is platform/implementation specific and
    >>> not a standardized part of the C language. Why not take a
    >>> look at the compiler and library documentation?

    >>
    >> In my experience, people asking this kind of questions should
    >> better spend their time actually learning C. By the time you
    >> actually understand what really C is about, the interest for
    >> such issues is very likely to vanish: as a C programmer, you
    >> couldn't care less.

    >
    >True - except that at one point I found myself writing a startup
    >function for an embedded system (along with the code to produce
    >argc and argv along with a split 'shell', half of which ran on an
    >NT system and half on the SoC under test).
    >
    >> By the time you're confronted with writing a C startup module
    >> yourself, you have enough clues to realise that c.l.c is one
    >> of the last newsgroups to ask for help.

    >
    >/Usually/ true. I didn't search to see if Ramaraj is new to c.l.c
    >- I just assumed that he found himself in a situation similar to
    >that described above.


    Nope, he was explicitly talking about hosted implementations, where one
    seldom gets to write a startup module. See the underlined text above.

    Freestanding implementations are a completely different issue, as each
    case has unique requirements:

    - is there any main function?

    - if yes, does it take any arguments?

    - is there any initialisation code executed before the startup module?

    - is the program supposed to ever terminate?

    - etc etc etc

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
    Dan Pop, Oct 21, 2003
    #5
  6. Ramaraj

    Morris Dovey Guest

    Re: [OT] C-startup Routine

    Dan Pop wrote:
    > In <GY%kb.143$> Morris Dovey
    >>>
    >>>> Ramaraj wrote:
    >>>>
    >>>>> I am very interest to know the c-startup routine (like
    >>>>> GNU gcc C-startup routine). and it s working principle
    >>>>> and How this function is attached to operating system
    >>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


    > Nope, he was explicitly talking about hosted implementations,
    > where one seldom gets to write a startup module. See the
    > underlined text above.


    Oops! You're right (bad assumption on my part) - thanks for
    underlining. Suddenly I'm in complete agreement. :)
    --
    Morris Dovey
    West Des Moines, Iowa USA
    C links at http://www.iedu.com/c
    Morris Dovey, Oct 22, 2003
    #6
  7. Ramaraj

    Sandeep Guest

    The C startup routine does the following:
    - Initialize all global variables to 0
    - Call standard library init
    - Prepares argc and argv
    - Calls main

    Sandeep
    --
    http://www.EventHelix.com/EventStudio
    EventStudio 2.0 - Generate Message Sequence Charts in PDF
    Sandeep, Oct 22, 2003
    #7
  8. Ramaraj

    Morris Dovey Guest

    Re: [still OT] C-startup Routine

    Sandeep wrote:
    > The C startup routine does the following:
    > - Initialize all global variables to 0
    > - Call standard library init
    > - Prepares argc and argv
    > - Calls main


    Sandeep...

    Perhaps (more or less; possibly more /and/ less :)

    [less] One would hope that the compiler emits code that
    pre-initializes all globals;

    [more] If the startup function calls main directly, then it will
    also need to provide for main's return.

    This /is/ off-topic for comp.lang.c because nearly every aspect
    of the subject is platform/implementation dependent; and the OP's
    question has nothing to do with the C language itself; but rather
    with a particular implementation (gcc) whose startup function is
    likely to vary at least somewhat for each target platform.

    Since the OP didn't specify a platform, providing a list of
    specifics is almost certainly a misleading response - however
    well-intended.
    --
    Morris Dovey
    West Des Moines, Iowa USA
    C links at http://www.iedu.com/c
    Morris Dovey, Oct 22, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page