Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the -ObjC linker flag do?

I have an app that works with and without the linker flag. However, without the linker flag, I get a very different behaviour when adding data to a view.

like image 816
bsarrazin Avatar asked Jul 08 '11 20:07

bsarrazin


People also ask

What does linker option do?

This feature permits the linker to link against a file which appears to be an object or an archive, but actually merely defines some symbol values, or uses INPUT or GROUP to load other objects.

What does ObjC linker flag do?

The -ObjC Linker Flag Passing the -ObjC option to the linker causes it to load all members of static libraries that implement any Objective-C class or category. This will pickup any category method implementations. But it can make the resulting executable larger, and may pickup unnecessary objects.

What is the purpose of the flag when compiling?

Compile-time flags are boolean values provided through the compiler via a macro method. They allow to conditionally include or exclude code based on compile time conditions. There are several default flags provided by the compiler with information about compiler options and the target platform.

What does linker do in Linux?

Linker merges all the sections of the same type into a new single section. For example, linker merges all the . data sections of all the input relocatable object files into a single . data section for the final executable.


1 Answers

This 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.

From this Technical Q&A

like image 197
sergio Avatar answered Oct 19 '22 06:10

sergio