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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:26:01+00:00 2026-06-12T11:26:01+00:00

I am certain I have done something wrong to make this happen. I am

  • 0

I am certain I have done something wrong to make this happen. I am using a library that declares a map statically in a way that seems to make sense.

In the header, in a class called Codec:

    typedef map< String, Codec* >::type CodecList; 
    static CodecList msMapCodecs;

In the cpp file:

    map< String, Codec * >::type Codec::msMapCodecs;

When I put a breakpoint on the line in the cpp file I have seen that it calls this in a stack frame called “__static_initialization_and_destruction_0” and if I step into it I can see it call the constructor for this map before main is reached. Just after main starts I insert some entries via function calls of the library API, then I notice the constructor is called a second time in a similar way to first.

What could cause this, or what and I misunderstanding that could confuse me enough to think this is happening? I have searched and I don’t see an explicit calls to the constructor. I could not duplicate this in a minimal test case. I know that providing an exact answer is not possible, but anything that will point me a good direction would be appreciated.

If it matters I am using gcc 4.6.3 on Ubuntu 12.04. x64

  • 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-12T11:26:02+00:00Added an answer on June 12, 2026 at 11:26 am

    This was a visibility/symbol version issue problem. There are a variety of ways to have corrected this. Since this only exists with this compiler on this OS I decided to alter the header file slightly and maintain the changes myself. I will let creators of the library know in case they want to incorporate this change.

    More details on symbol visibility can be found at: http://gcc.gnu.org/wiki/Visibility

    Here are the changes I made to the code:

    #if __GNUC__ >= 4
        // This block will be included only will the compiler
        #define DLL_LOCAL  __attribute__ ((visibility ("hidden")))
    #else
        #define DLL_LOCAL
    #endif
    
    // <- Some details omitted here
    
    typedef map< String, Codec* >::type CodecList; 
    DLL_LOCAL static CodecList msMapCodecs;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time using Stack Overflow, so if I've done something wrong
I'm using .net 2.0. This is a project that I have taken over for
i have done something like this: myProject = settings: duration: 500 value: 'aValue' aFunction:
I'm pretty sure someone will have done something like this before but have been
I have a certain check to be done and if the check satisfies, I
I have certain PHP class methods that access external variables. These variables are not
I have certain panels on my page that are hidden under certain circumstances. For
I have certain critical bash scripts that are invoked by code I don't control,
I have certain initializing functions that I use to set up audit logging on
Can I have certain settings that are universal for all my users?

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.