Question

I'm little bit confused with the linker flags available on iOS.

This question may not be a good one accoring to the faq, but I don't know anything about the linker flags, and I'm curious about it. That's why I'm asking it here.

  1. What is the use of -ObjC linker flag ?
  2. What is the use of -all_load ?
  3. What is the use of -force_load ?

What are the other frequently used linker flags available for iOS ?

Please help me to understand the linker flag usage. Thanks in advance.

Was it helpful?

Solution

  • -ObjC flag causes the linker to load every object file in the library that defines an Objective-C class or category. While this option will typically result in a larger executable (due to additional object code loaded into the application), it will allow the successful creation of effective Objective-C static libraries that contain categories on existing classes.
  • -all_load flag forces the linker to load all object files from every archive it sees, even those without Objective-C code.
  • -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.

for additional information you can read this document

EDIT

you can see all flags supported by ld in ld ManPage in following document

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top