0

I'm building my own library and I'm quite confused with how does the final executable linking process work.

I have a MyLibrary.framework which uses CoreLocation header.

When I set Mach-o type to static the framework builds without problem, even though I didn't link the CoreLocation.framework in "Linked Frameworks and Libraries".

When I link MyLibrary.framework to my iOS test project, I have to add CoreLocation.framework, because otherwise I get unreferenced symbols errors.


Question

Why doesn't building my static library need the reference the CoreLocation, and why does building my app require linking to CoreLocation ? What happens there ?


michal.ciurus
  • 3,616
  • 17
  • 32

1 Answers1

0

The answer from Mecki here:

Objective-C categories in static library

Explains the compiling/linking process very well. A .a file is an (.a)rchive of .o files.

each .o files contains not only the symbols it has, but also the symbols it needs.

Only during the executable linking process the linker resolves all the symbols in the executable file, which references a static library, which references the CoreLocation library.

Community
  • 1
  • 1
michal.ciurus
  • 3,616
  • 17
  • 32