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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:38:29+00:00 2026-05-20T04:38:29+00:00

I compiled a C++ library under Linux/Mac with its symbols hidden. I’ve used __attribute__

  • 0

I compiled a C++ library under Linux/Mac with its symbols hidden. I’ve used __attribute__ ((visibility("hidden"))) for all my classes and compiled with options (-c -O2 -fPIC -MMD -MP -MF). Under Mac, using MacDependencies, the job is done just fine as I see only my exports (I actually saw the difference before and after).

However, I noticed that using nm I still see all the names of the symbols. This happens under both Mac and Linux.

Why is that? Is there any way to avoid this?

  • 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-20T04:38:29+00:00Added an answer on May 20, 2026 at 4:38 am

    Public or hidden, symbols are still there. nm shows all symbols. The difference is that hidden symbols are not available to the dynamic linker, i.e. not exported and can not be interposed.

    You might also like the following man gcc:

       -fvisibility=default|internal|hidden|protected
           ...
           A good explanation of the benefits offered by ensuring ELF symbols
           have the correct visibility is given by "How To Write Shared
           Libraries" by Ulrich Drepper (which can be found at
           <http://people.redhat.com/~drepper/>)---however a superior solution
           made possible by this option to marking things hidden when the
           default is public is to make the default hidden and mark things
           public.  This is the norm with DLL's on Windows and with
           -fvisibility=hidden and "__attribute__ ((visibility("default")))"
           instead of "__declspec(dllexport)" you get almost identical
           semantics with identical syntax.  This is a great boon to those
           working with cross-platform projects.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've successfully compiled my library on Linux and Mac and used it with Java
I have an asynchronous library which is compiled under .NET 3.5, since it's used
I've got a .so library compiled for Linux under the ELF format, which is
I have a Linux library that needs to be compiled under Android. I understand
Under gcc (g++), I have compiled a static .a (call it some_static_lib.a ) library.
I'm a newbie about boost. I compiled boost libraries with success (under mac os
If the C++ runtime msvcr80.dll is missing from a compiled library, is there any
I've got a compiled static library (with an a extension) I want to include
Is it possible to use a library compiled by visual studio in an application
Say, for example, I have many web applications using the same class library compiled

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.