Apple interview question

How does the runtime program loader work?

Interview Answers

Anonymous

17 Dec 2010

this depends a lot on the executable file format and what the OS expects an 'executable' to be (a DOS COM file won't work like a Linux ELF or an OSX Mach-O file) however, the loader should be ready to resolve dynamic symbols needed by the file, by loading and mapping libraries into the new process' address space (unless symbols are loaded lazily, such as GetProcAddress() in Win32). once all this is complete, the loader should give control to the start routine of the process, which in most cases is not going to be the user's provided main() but some standard library initializing routine

3

Anonymous

1 Feb 2010

dunno. Seen it in college, never had to worry about those details.