Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Initialization of static anonymous-namespace members from a dynamicallyloaded lib

Reply
Thread Tools

Re: Initialization of static anonymous-namespace members from a dynamicallyloaded lib

 
 
Ian Collins
Guest
Posts: n/a
 
      01-11-2011
On 01/11/11 11:28 PM, Bart van Ingen Schenau wrote:
> On Jan 10, 2:51 pm, James Kanze<(E-Mail Removed)> wrote:
>>
>> The fact remains that in computer science, "library" means (or
>> always used to mean) a collection of object files, each of which
>> was included only if it resolved an unresolved external. When
>> dynamically linking, it's all or nothing.

>
> Apparently, even computer scientists are not consistent with the use
> of "library".
> I have a textbook here that uses the term "shared library" for those
> entities that get linked into the executable at load time.
> The book is
> Linkers and Loaders; Academic Press; John R. Levine; 1-55860-496-0


I have a CC man page that says:

-G Build a dynamic shared library instead of an executable
file; see the ld(1) man page and the C++ User's Guide.

gcc's man page has several references, including:

-static-libgcc
On systems that provide libgcc as a shared library,

--
Ian Collins
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      01-11-2011
On Jan 11, 10:28 am, Bart van Ingen Schenau <(E-Mail Removed)>
wrote:
> On Jan 10, 2:51 pm, James Kanze <(E-Mail Removed)> wrote:
> > The fact remains that in computer science, "library" means (or
> > always used to mean) a collection of object files, each of which
> > was included only if it resolved an unresolved external. When
> > dynamically linking, it's all or nothing.


> Apparently, even computer scientists are not consistent with the use
> of "library".


That was, I think, the point of Alf's responding with a Google
search reference. Finding one (or even a lot) of such uses
wouldn't really surprise me, but some of the were definitly from
people who knew what they were talking about.

> I have a textbook here that uses the term "shared library" for those
> entities that get linked into the executable at load time.
> The book is
> Linkers and Loaders; Academic Press; John R. Levine; 1-55860-496-0


Who is a recognized expert in the field.

All I can say is that the meaning has changed. I learned most
of this stuff a long time ago, and back then, library very
definitely had the meaning I associate with it. (The
conversations I remember in the C committee also go back some in
time.) And in the Unix world, we spoke of "shared objects", and
not shared libraries. IMHO, we've lost something in loosing
this distinction.

--
James Kanze
 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      01-11-2011

"James Kanze" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Jan 11, 10:28 am, Bart van Ingen Schenau <(E-Mail Removed)>
> wrote:
>> On Jan 10, 2:51 pm, James Kanze <(E-Mail Removed)> wrote:
>> > The fact remains that in computer science, "library" means (or
>> > always used to mean) a collection of object files, each of which
>> > was included only if it resolved an unresolved external. When
>> > dynamically linking, it's all or nothing.

>
>> Apparently, even computer scientists are not consistent with the use
>> of "library".

>
> That was, I think, the point of Alf's responding with a Google
> search reference. Finding one (or even a lot) of such uses
> wouldn't really surprise me, but some of the were definitly from
> people who knew what they were talking about.
>
>> I have a textbook here that uses the term "shared library" for those
>> entities that get linked into the executable at load time.
>> The book is
>> Linkers and Loaders; Academic Press; John R. Levine; 1-55860-496-0

>
> Who is a recognized expert in the field.
>
> All I can say is that the meaning has changed. I learned most
> of this stuff a long time ago, and back then, library very
> definitely had the meaning I associate with it. (The
> conversations I remember in the C committee also go back some in
> time.) And in the Unix world, we spoke of "shared objects", and
> not shared libraries. IMHO, we've lost something in loosing
> this distinction.
>
> --
> James Kanze
>


What part of "YOU ARE WRONG" do you not understand?

Who cares if IYHO you have lost something when you were wrong about what you
think you've lost.

 
Reply With Quote
 
Balog Pal
Guest
Posts: n/a
 
      01-11-2011
"James Kanze" <(E-Mail Removed)>
> All I can say is that the meaning has changed. I learned most
> of this stuff a long time ago, and back then, library very
> definitely had the meaning I associate with it. (The
> conversations I remember in the C committee also go back some in
> time.) And in the Unix world, we spoke of "shared objects", and
> not shared libraries. IMHO, we've lost something in loosing
> this distinction.


Yeah, as I see it, the meaning of term "library" got diluted. Not for really
good. The original name "shared object" made more sense.

And the windoze name DLL meaning 'Dynamic Link Library' is plain broken, as
windows never had the linker involved at execution time, the DLL is handled
by the module loader and only involves the segment/address fixups. DLL may
come without a single symbol exported binding entry points just through
ordinals. If export names are provided they are not by the system but by the
client progam to get an address. (compilers can use a trick through
"implib", providing stubs and jmp tables, but the idea is the same in the
deep.)


 
Reply With Quote
 
Keith H Duggar
Guest
Posts: n/a
 
      01-11-2011
On Jan 10, 8:51*am, James Kanze <(E-Mail Removed)> wrote:
> On Jan 10, 11:01 am, "Alf P. Steinbach /Usenet"
> <(E-Mail Removed)> wrote:
> > * James Kanze, on 10.01.2011 11:26:
> > > On Jan 10, 12:05 am, "Alf P. Steinbach /Usenet"
> > > <(E-Mail Removed)> *wrote:
> > >> * James Kanze, on 10.01.2011 00:03:
> > >>> On Jan 9, 9:00 pm, "Alf P. Steinbach /Usenet"<alf.p.steinbach
> > >>> (E-Mail Removed)> * wrote:
> > >>>> * m0shbear, on 09.01.2011 21:56:
> > >>> * * * [...]
> > >>> * (I don't know of any that can dynamically load a
> > >>> library. *But despite the name, under Windows, a DLL is not a
> > >>> library.)
> > >> Windows Dynamically Loaded Library, *nix Shared Library.
> > > What's a Unix shared library? *I've never heard the term before.

> > Try <url:http://www.google.com/search?q=%22shared+library%22>.

>
> You can find anything using Google. *It never occured to me.
> I guess just basing my knowledge on the Posix standard and the
> Sun manual. *And conversations with other Unix specialists:
> after all, .so didn't come from shared library, but from shared
> object.


I would also point out that the Unix convention (I think) is to
prefix the library file with 'lib'. I'm not sure how far back in
history that convention spans but it would seem to indicate some
cognition of the "library" sense. Such as "library archive" and
"library shared object" for lib*.a and lib*.so respectively.

> The fact remains that in computer science, "library" means (or
> always used to mean) a collection of object files, each of which
> was included only if it resolved an unresolved external. *When
> dynamically linking, it's all or nothing.


So the Standard Template Library (STL) is a collection of object
files? Or the name violates the computer science sense?

> Anyway, trying your link, I see that it's not just newbes using
> the term, even if Posix and Sun don't. *The Linux and gcc
> communities seem to have adopted it. *Which makes me think that
> I'm fighting a loosing battle for linguistic purity.*The fact


The French have been doing that for a long long time ...

KHD
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      01-12-2011
On Jan 11, 6:07 pm, "Balog Pal" <(E-Mail Removed)> wrote:
> "James Kanze" <(E-Mail Removed)>


> > All I can say is that the meaning has changed. I learned most
> > of this stuff a long time ago, and back then, library very
> > definitely had the meaning I associate with it. (The
> > conversations I remember in the C committee also go back some in
> > time.) And in the Unix world, we spoke of "shared objects", and
> > not shared libraries. IMHO, we've lost something in loosing
> > this distinction.


> Yeah, as I see it, the meaning of term "library" got diluted.
> Not for really good. The original name "shared object" made
> more sense.


Well, the most important single point is that it is dynamically
linked; sharing was the original motive, but a lot of "shared
objects" (e.g. plugins) aren't shared today. On the other hand,
I do think we've lost something concerning the word library:
originally, libraries where handled one way, and object files
another. Now, static libraries are handled one way, and object
files and dynamic libraries another. Seems less clear (or at
least more verbose) to me.

> And the windoze name DLL meaning 'Dynamic Link Library' is
> plain broken, as windows never had the linker involved at
> execution time, the DLL is handled by the module loader and
> only involves the segment/address fixups.


That's not really relevant. I don't think any system actually
invokes the linker when loading a dynamic object. I don't think
early SunOS did any fixups: the loaded object had to be position
independent code, and it used some sort of fixed table of
addresses at the beginning (I think---I'm not sure about the
second part). Ideally, you should be able to map the object
directly, without copying it into virtual memory in any way. (I
don't think modern object file formats support this, but I've
used some in the past that did.)

--
James Kanze
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      01-12-2011
On Jan 11, 6:43 pm, Keith H Duggar <(E-Mail Removed)> wrote:
> On Jan 10, 8:51 am, James Kanze <(E-Mail Removed)> wrote:
> > On Jan 10, 11:01 am, "Alf P. Steinbach /Usenet"
> > <(E-Mail Removed)> wrote:
> > > * James Kanze, on 10.01.2011 11:26:
> > > > On Jan 10, 12:05 am, "Alf P. Steinbach /Usenet"
> > > > <(E-Mail Removed)> wrote:
> > > >> * James Kanze, on 10.01.2011 00:03:
> > > >>> On Jan 9, 9:00 pm, "Alf P. Steinbach /Usenet"<alf.p.steinbach
> > > >>> (E-Mail Removed)> wrote:
> > > >>>> * m0shbear, on 09.01.2011 21:56:
> > > >>> [...]
> > > >>> (I don't know of any that can dynamically load a
> > > >>> library. But despite the name, under Windows, a DLL is not a
> > > >>> library.)
> > > >> Windows Dynamically Loaded Library, *nix Shared Library.
> > > > What's a Unix shared library? I've never heard the term before.
> > > Try <url:http://www.google.com/search?q=%22shared+library%22>.


> > You can find anything using Google. It never occured to me.
> > I guess just basing my knowledge on the Posix standard and the
> > Sun manual. And conversations with other Unix specialists:
> > after all, .so didn't come from shared library, but from shared
> > object.


> I would also point out that the Unix convention (I think) is to
> prefix the library file with 'lib'. I'm not sure how far back in
> history that convention spans but it would seem to indicate some
> cognition of the "library" sense. Such as "library archive" and
> "library shared object" for lib*.a and lib*.so respectively.


Yes. Good point: the Unix conventions are ambiguous. Of
course, in the end, it is neither a library (an ranlib'ed
archive, under Unix) nor an object file, but something rather
different from both. And while it works more like an object
file than a library, in most cases, it's used more like
a library---the file has some functions I want to call, so
I link against it, in order to get those functions. (In most
cases, as long as we're only talking about functions, and not
static initializers, the fact that I get everything, and not
just what I actually need, makes no real difference to me.)

> > The fact remains that in computer science, "library" means (or
> > always used to mean) a collection of object files, each of which
> > was included only if it resolved an unresolved external. When
> > dynamically linking, it's all or nothing.


> So the Standard Template Library (STL) is a collection of object
> files? Or the name violates the computer science sense?


Or we're dealing with something new. But in fact, I was
being too restrictive: you can have libraries with other things
than object files; the definition of library I used is really
only relevant to linkables.

There is a sense that STL violates the older conventions for
libraries. On the other hand, there doesn't seem to be another
word that fits, either. So some word will have to have its
meaning expanded, and library seems appropriate.

--
James Kanze
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cpp + Python: static data dynamic initialization in *nix shared lib? Alf P. Steinbach /Usenet Python 17 07-14-2010 10:39 AM
Cpp + Python: static data dynamic initialization in *nix shared lib? Alf P. Steinbach /Usenet C++ 10 07-13-2010 09:28 PM
any python wrapper to call .lib static library(ufmod.lib)? est Python 1 02-16-2008 10:56 AM
Perl MakeMaker - how to force Perl linking with the static C library (libcrt.lib) instead of dynamic C library (msvcrt.lib) Avi Perl Misc 0 04-17-2007 09:20 PM
Difference between static final members and final static members(if any)? JFCM Java 4 02-07-2006 11:32 AM



Advertisments