Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:27:01+00:00 2026-06-03T00:27:01+00:00

Why exactly is it that when I create an iOS static library project or

  • 0

Why exactly is it that when I create an iOS static library project or framework project in Xcode, I don’t need to link any iOS SDK frameworks to the project in order to make use of their headers and objects — for example, I can #import <AudioToolbox/AudioToolbox.h> and put AudioToolbox code in the static library or framework without actually having AudioToolbox added under “Link Binary with Libraries” in build settings or having it present in the file navigator, and the project will build without issue, something that wouldn’t work in an app project — but when a developer then uses the static library or framework product in an app, they do have to link to the framework in order to use the same headers and objects?

I have a vague idea of why this would be, but I’d be really interested in hearing from someone who knows for sure.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:27:02+00:00Added an answer on June 3, 2026 at 12:27 am

    Static libraries are just a bundle of .o files. They’re not “linked” in any meaningful way; just concatenated together. It’s not until you perform a real link step that symbols are resolved.

    There is basically no difference between linking a .a with your executable and copying the equivalent source code into your executable’s project. So there’s no need to link with any additional frameworks or libraries until that time.


    The following exercise may be educational:

    Create the following comptest.c:

    #include <stdio.h>
    
    int main() {
       printf("Hello world.\n");
       return 0;
    }
    

    See what the pre-processor does:

    gcc -E comptest.c > comptest-cpp.c
    

    This removes the #include and replaces it with the contents of the referenced file. This file is what the compiler actually sees.

    Now see what the compiler does (I’m using the > syntax here and below so that things are parallel with -E):

    gcc -S comptest.c > comptest.s
    

    This is the generated assembly language after pre-processing and compilation. Now we turn that into a .o:

    gcc -c comptest.c > comptest.o
    

    Now let’s see what’s in that .o:

    $ nm comptest.o
    0000000000000040 s EH_frame0
    000000000000002d s L_.str
    0000000000000000 T _main
    0000000000000058 S _main.eh
                     U _puts
    

    The important things here are _main and _puts. _main is defined in this file at address 0. _puts is undefined. So something we link with had better provide it. Let’s try linking without anything:

    $ gcc -nodefaultlibs comptest.o
    Undefined symbols for architecture x86_64:
      "_exit", referenced from:
          start in crt1.10.6.o
      "_puts", referenced from:
          _main in comptest.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    

    (_exit is implicit from the C runtime; it’s not directly referenced in the .o)

    OK, so now we’re ready to put it all together. We’ll be explicit:

    gcc -nodefaultlibs comptest.o /usr/lib/libc.dylib -o comptest
    

    This says to link together comptest.o and the dynamic library libc. It promises that every symbol referenced will be provided by one of these files. It makes a note in the resulting binary that it should dynamically load symbols from /usr/lib/libc.dylib (this is a symlink to libSystem.B.dylib, which is itself an “umbrella framework” rather than a proper library, but that goes a little past what you need to know in most cases; you can pretend that puts() is in libSystem):

    $ otool -L comptest
    comptest:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
    

    If you link with a static library, it’s identical to listing all the .o files included in it on the command-line.

    Notice that at the link step, we just have .o and .dylib files (.a is just a package of .o). There are no .c files, no .h files, no .s files, no source code. Just object files that need symbols resolved. This is why header files don’t matter here, but do matter when you’re compiling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQuery to create an element that exactly overlays any existing one. That's
I have created an empty project (XCode 4.2 IOS SDK 5), I have added
I need a calendar View in my iOS 5 project. I found this Library
I'd like to create a customized checkbox that behaves exactly like StackOverflow's "accept answer"
basic problem: i need to create real customized templates for my django forms. That's
I'm trying to create a textarea that looks exactly like a div . However,
I know that the simulator and the actual iOS hardware are not EXACTLY the
I'd like to create an MKAnnotation that looks exactly the same as the default,
I've just downloaded the Facebook iOS SDK and I noticed that in the sample
When new product is created in Magento, then how exactly that get saved in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.