Brett McCoy wrote:
> On Sat, May 24, 2008 at 10:46 PM, odbapsvm <[EMAIL PROTECTED]> wrote:
> 
>> Sorry, I meant to ask where is the prototype
>> for the main function?
> 
> There isn't one. It's declared and defined in the same place. Your
> compiler "knows" what to do when it compiles a source file with main()
> in it.
> 
> -- Brett
> ------------------------------------------------------------
> "In the rhythm of music a secret is hidden;
>  If I were to divulge it, it would overturn the world."
>  -- Jelaleddin Rumi
> 
> ------------------------------------

Technically-speaking, that isn't entirely true.  Most compilers seek out 
a compiler-defined "entry point".  The compiler is also configured to 
know where the C/C++ runtime libraries (.lib) files are located.  The 
runtime libraries export the entry point the compiler is looking for and 
then create a dependency on a function called main() (i.e. the .obj/.lib 
file creates the dependency, some compilers use #pragma directives to 
make main() a special function).

Here's a link to an article on the evil side of the VC++ compiler (code 
requires tweaks to get it "working" under modern VC++):

http://msdn.microsoft.com/en-us/magazine/cc301696.aspx

I don't recommend rolling your own library.  Leave that to the compiler 
authors.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to