Cocoa: main int function

I'm curious what role does the main int function play in a Cocoa program? Almost the entire code sample that I was looking at has only the following code in main.m:

#import <Cocoa/Cocoa.h>


int main(int argc, char *argv[])
{

    return NSApplicationMain(argc,  (const char **) argv);
}

What exactly does this do, and where does the program really begin to go through the commands? It seems that my concepts need restructuring.

+5
source share
5 answers

Cocoa , , . Cocoa , NSApplicationMain, , .

Apple Cocoa : Mac OS X

+10

, " " main(), man execve . dyld. main() Unix. , , main().

, NSApplicationMain Cocoa. documentation , .

, NSApplicationMain . , NSApplicationMain main , .

+5

main() - .

, . .

, Objective-C. C.

+4

, , , .

Shell , , $?:

> ls
a b c

> echo $?
0

> ls x
x: No such file or directory

> echo $?
1

ls - , .

script , .

0

, (, NSView ?), int main(), ?

xcode main.m, 'int main'. , NSView, iPhone Mac OS X. , , "int main", , , . , , , , -, .

, , " ", "int main".

, ++. , .

'int main'. , , . , . Apple "" iPhone main.m:

int retVal = UIApplicationMain(argc, argv, nil, @"SillyAppDelegate");

.

0

All Articles