This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/7769: using static libraries sometimes loses static initialization


Synopsis: using static libraries sometimes loses static initialization

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Thu Dec 19 17:40:05 2002
State-Changed-Why:
    This is not a bug. When you want that a particular 
    object file (possibly within an archive) is pulled into you
    executable for sure, then you have to reference an object
    inside it.
    
    If you rename your class "A" to "ComplexClass", to make
    its symbols better visible in the executable, you
    see that the object file with the static constructor
    is not even pulled into the executable:
    g/static_init> nm main1 | grep ComplexClass
    080485f0 W __12ComplexClass
    g/static_init> nm main2 | grep ComplexClass
    g/static_init> nm main3 | grep ComplexClass
    g/static_init> nm main4 | grep ComplexClass
    080485f0 W __12ComplexClass
    
    I guess this is just how the linker works.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7769


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]