Created
August 8, 2014 08:14
-
-
Save yuanshanxiaoni/02e261aedeafb6321b2e to your computer and use it in GitHub Desktop.
objc runtime bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The runtime does some initialization via constructor functions that get called before actual program execution. They go by __attribute__((constructor)) in both gcc and clang. | |
| In the case of Objective-C some of them are embedded in the binary by the compiler. You would have to include them in your headers for similar effect. | |
| These functions use data automatically embedded by the compiler. They do things such as building hash tables for the class lookup function which are then used for the actual message passing. | |
| Instances on the other hand are allocated dynamically. | |
| I am doing something similar, so I don't really know a lot better than that, but this is as deep as I have dug. | |
| [https://stackoverflow.com/questions/2219501/how-does-the-objective-c-runtime-instantiate-the-root-metaclass-and-other-class] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course, that is done for convenience, but if you had your class descriptions stored in data files you could build the structures you need from a file. The difference is that the compiled Objc generates structures that are readily usable by the runtime, so you would be doing that part of the work JIT.