C Application source- which file contains main()?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • developing
    New Member
    • Mar 2007
    • 110

    C Application source- which file contains main()?

    Hello people, I downloaded a few open source frameworks in hopes of looking at the source and learning a few things. All was fine till I got totally lost on where to start.

    i downloaded the source for *nix...

    eg: I downloaded the source for php framework. Now I want to see how 'echo' function is implemented...I can't figure out where to look.

    Same thing with an app called 'wireshark'...i downloaded the source for mac os x, but i cant find the file which has main...

    someone please help me start...

    i am thinking there might be a convention on file structure of the source code in the open source community....

    someone please enlighten me

    thanks
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    I’m going to throw http://scientificninja.com/advice/dont-read-source-code out there for you to read.

    There isn’t a convention. It’s very hard for experienced programmers to scavenge through source code. It’s near impossible for beginners. For example, in Wireshark, I identified potention main functions (the aclocal.m4 and main.c file should main and WinMain functions) with grep and a bit of good guesses. But there wasn’t any convention followed.

    Comment

    • developing
      New Member
      • Mar 2007
      • 110

      #3
      well thanks...as much as i support self learning, i have to agree with the article...

      code gets hacked all the time. That said, I am not looking to copy paste or save snippets, just looking to see how those guys think

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        Actually, I won't complain too much about looking through source code. But I caution relying on it blindly.

        You can see outright their build system and multiple code paths for multiple platforms. So they have to conditionally compile code based on the platform. That, and they have to deal with each platform's low level networking functionality. So a lot of parallel code paths, each quite huge in size.

        If you're going to work through the code, grep comes in very handy.

        Comment

        Working...