Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

C Application source- which file contains main()?

Question posted by: developing (Member) on June 26th, 2008 09:23 PM
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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
oler1s's Avatar
oler1s
Expert
613 Posts
June 26th, 2008
11:07 PM
#2

Re: C Application source- which file contains main()?
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.

Reply
developing's Avatar
developing
Member
81 Posts
July 3rd, 2008
07:00 AM
#3

Re: C Application source- which file contains main()?
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

Reply
oler1s's Avatar
oler1s
Expert
613 Posts
July 4th, 2008
12:09 AM
#4

Re: C Application source- which file contains main()?
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.

Reply
Reply
Not the answer you were looking for? Post your question . . .
180,786 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top C / C++ Forum Contributors