PDA

View Full Version : Trying to patch a C program for my needs.



arkashkin
March 9th, 2010, 07:26 PM
Hello,

I have downloaded the source code of glade 3.6.7 and trying to find out where the code begins, the 'main' function... how the compiler knows in which file to look for the main function? Is it usually written some where in the make-file?
I just want to add some very simple code in the place where the program begins...

Thanks.

MadCow108
March 9th, 2010, 07:46 PM
the main is usually in the main.c file
also in glade:
http://git.gnome.org/browse/glade3/tree/src/main.c
line 73

a quick recursive grep would also have found it
I also recommend cscope for quick code searching

the compiler does not care if there is a main function or not. It just compiles everything.
The linker (mostly invoked by gcc after compiling) then requires that there is the main symbol in one of the object files passed to it as arguments.
If there isn't it outputs an error.

arkashkin
March 9th, 2010, 07:56 PM
the main is usually in the main.c file
also in glade:
http://git.gnome.org/browse/glade3/tree/src/main.c
line 73

a quick recursive grep would also have found it
I also recommend cscope for quick code searching

the compiler does not care if there is a main function or not. It just compiles everything.
The linker (mostly invoked by gcc after compiling) then requires that there is the main symbol in one of the object files passed to it as arguments.
If there isn't it outputs an error.

Thanks a lot.

ssam
March 9th, 2010, 10:23 PM
there is also ack-grep for searching in code (its a wrapper around grep).



ack-grep 'main('

would find it.