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 7529869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:45:33+00:00 2026-05-30T04:45:33+00:00

I have a library, foo, for which I’ve produced a static object (libfoo.a). I

  • 0

I have a library, foo, for which I’ve produced a static object (libfoo.a).

I have a second library, bar, for which I’ve produced a shared object (libbar.so), which picks up some symbols from libfoo.a.

I have a third library, baz, for which I’m trying to link to bar. Upon invoking the linker, I get errors about symbols missing in bar (corresponding to symbols that are in foo). nm tells me that these symbols exist in libfoo.a, but not in libbar.so; however, there are some symbols from libfoo.a in libbar.so.

Why aren’t all symbols being copied?

  • 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-05-30T04:45:34+00:00Added an answer on May 30, 2026 at 4:45 am

    A .a library is not a “static object”. A .a file is an archive, similar in theory to tar, but a different format and generated by the ar command. Each object in the archive is distinct and individual. Usually these objects are .o files, which are compiled, unlinked objects. All the symbols in one of those .o files would be included in another files during linking (ld). But not all objects in an archive would be required during linking, the symbols in the other object files would not be seen in the linked file.

    For example, in libdialog.a, there are mouse.o and columns.o object files. Your program uses columns, but not the mouse functions. So your program includes all the symbols in columns.o, but none of the symbols in mouse.o are included.

    With a “shared object” (.so), it is a single object, so linking against it will include all the symbols in the object, needed or not. In the example above, if we linked against libdialog.so, then the program would include the symbols from both columns.o and mouse.o even though the mouse based code is not used.

    When generating a shared object (.so), the same linkage rules apply when using an archive (.a). So the .so file will only include the symbols in the .o files in the archive that are used.

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

Sidebar

Related Questions

I have a shared library say foo.so which contains a function called initialize() .
So, if I have website project Foo which has a reference to class library
I have a static class member class bar {...} class foo { public: static
In some library I create I have to use following cast: public void Foo(IList<uint>
I have a library, libfoo which is made of the following files: base.hpp #ifndef
I have a DLL file library.dll which contains a function foo . The function
I have gdata library install on my ArchLinux, and a simple application which imports
I have a method void foo(list<shared_ptr<Base>>& myList); Which I'm trying to call with a
I have a question on shared libraries vs static libraries loading time. Assume that
Basically I have code which looks like this inside a header file: class Bar;

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.