From 2269984241064532798
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,a554381e70cda7e7,start
X-Google-Attributes: gidf78e5,public
X-Google-Thread: fc772,a554381e70cda7e7,start
X-Google-Attributes: gidfc772,public
From: ruchrist@online.no (Rune Christensen)
Subject: Adding extensions to library at link time
Date: 1997/07/21
Message-ID: <fjh-970722-042038@cs.mu.oz.au>#1/1
X-Deja-AN: 258008332
X-Submission-Address: c++-submit@netlab.cs.rpi.edu
X-Original-Date: Mon, 21 Jul 1997 08:06:19 GMT
X-Approved: Herb Sutter <HerbS@cntc.com> comp.lang.c++.moderated
Organization: Win.HLP
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBM9OofOEDnX0m9pzZAQFWJgGAjLTp6qC3j6r/AEb4wQXP6dqBbxYaJ7Ty JjmkkaBpXdxM82jiUpeTPCKIp0Cr2gCP =4Eux
Reply-To: ruchrist@online.no
Newsgroups: comp.lang.c++.moderated,comp.std.c++
Originator: fjh@murlibobo.cs.mu.OZ.AU


I have written a library system where I want the user / client to be
able to add extensions at link time. The extension should
automatically be added whenever a global function (or object /
variable) exists in the client code (Preferably it should be added to
some library array so that multiple extensions can be handled). This
to guarantee that extension has been hooked up already when
constructors for static objects are called, and so the client doesn't
have to make sure the extension has been added 'in time'.

I remember that for Borland C++ this could be implemented by defining
a dummy (empty) function in a library. If linker found that name in
earlier linked object file (or library?), it would ignore this second
instance.

Is this Borland C++ 'feature' standard C/C++? (Does standard say
anything relevant about linking?)
Can anyone suggest any other standard way to implement this?


Best regards,
Rune Christensen



      [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
      [ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]



