Sure, your program has a main()
function like any C program. The default one that comes with a new Cocoa project just calls NSApplicationMain()
, but you can do other actions if you'd like.
If you want to easily access the command line information from elsewhere in your program, you can use _NSGetArgv()
, _NSGetArgc()
, _NSGetEnviron()
, and _NSGetProgname()
. They're declared in crt_externs.h
:
extern char ***_NSGetArgv(void);
extern int *_NSGetArgc(void);
extern char ***_NSGetEnviron(void);
extern char **_NSGetProgname(void);
Here's a blog post about these functions, and a link to the NSApplicationMain
documentation.