Reputation: 221
I am developing an operating system from scratch for ARM processors in c and assembly. I have finished the kernel and I am beginning to start the userspace (an evironment where applications can be run). I am going to have my applications programmed in C and compiled in gcc.
How can I have gcc compile the .c files in such a way that they are compiled so they come out as a specific file format (ex. .app, .exe, .apk, .ipa)
How can the operating system run the file? By this I mean, when the user selects the application from the List of apps how will the operating system interact with the file and tell the application "The app is open call OnApplicationOpen()"?
P.S. Also sorry how the question was phrased. It was difficult to explain
Upvotes: 1
Views: 102
Reputation: 24847
1) 'come out as a specific file format' - usually, the linker does that. Look at your linker options.
2) I don't know - it's your OS! Basically, inspect the executable header to find out what resources are required, allocate them, read in the sections that need to be loaded, zero those sections that need to be zeroed, relocate sections that need to be relocated, find the code start address, create a thread to run it.
Upvotes: 2