This is the mail archive of the gcc@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]

Re: MPE Port


  In message <4.2.0.58.19991108193122.00c7c220@garfield.dis.com>you write:
  > At 03:38 AM 9/13/99 -0600, Jeffrey A Law wrote:
  > 
  > >collect is supposed to look at all the files on the link line for construc
  > tors
  > >and add them to th ctor/dtor list.
  > 
  > Why does collect explicitly not add symbols from a shared library to the
  > constructor/destructor list? How would those constructors/destructors
  > ever get run on another platform if they were in a shared library or is
  > there another mechanism in that case?
Because if someone replaced the library, then all the applications linked
against the library would have to be re-linked just in case the list of
ctors/dtors changed.

So instead collect builds and exports a single constructor function for the
entire library.  *that* function should be added to he ctor/dtor list for
the main program.

That way the shared library can be updated and programs linked against the
library do not need to be relinked if the library's initialization requirements
changed.


jeff


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