-all_load,-ObjC,-force_load三者的区别

时间:2023-03-09 23:41:05
-all_load,-ObjC,-force_load三者的区别

参考:https://developer.apple.com/library/mac/qa/qa1490/_index.htmlhttp://www.cnblogs.com/YouXianMing/p/3595945.html

-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code.

-force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.

-ObjC causes the linker to load every object file in the library that defines an Objective-C class or category.

Important: For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags.