help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler doesn't create some static class members


From: Nicolas Deslandes
Subject: Re: Compiler doesn't create some static class members
Date: Sun, 6 Mar 2005 01:02:54 +0100

I was having the same problem with Visual C++, and I "solved" it by using a
#pragma macro that creates an explicit reference to a symbol (basically I
have a header to be included by the library users that contains all the
#pragma for the static members I want to add references to).To use the
librarian analogy, it simply adds names to the "needed list" before going
through the bookshelves.

Is there something similar usable with g++ ?

Thanks,

-- 
Nicolas

"Paul Pluzhnikov" <ppluzhnikov-nsp@charter.net> a écrit dans le message de
news: m37jlpd4uo.fsf@salmon.parasoft.com...
> johan_de_taeye@yahoo.com (Johan_De_Taeye) writes:
>
> > Sorry, my code had some typo indeed...
>
> Did you use google 'reply' button to post this message?
> If so, google groups are even buggier then I thought :-(
> If not, please *do* use it next time: this creates (or rather it
> should create) a follow-up message, rather then starting a new
> thread.
>
> > Following the comparison with the librarian: The way the metadata is
> > used seems to make it difficult for the librarian to understand that
> > the metadata objects are required on its 'needed' list.
>
> That means your code is not structured correctly.
> It's not librarian's fault. The analogy would be:
> you gave librarian a list with one specific book reference, and
> she came back with that book. Now you are complaining that she
> didn't also bring 10 other books, which you need but didn't tell
> her about.
>
> > I ended up adding a library initialization function like this:
>
> That's one way.
>
> Another way would be to link all of the objects that construct
> '{A,B,C}::meta' into a shared library. With shared libraries,
> you get all or nothing.
>
> A third way is to link objects explicitly:
>
>   g++ -o foo.exe main.o a.o b.o c.o ...
>
> [this is equivalent to explictly referencing the 10 books you need
> by their ISBN number, so librarian knows exactly what you want.]
>
> Cheers,
> -- 
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]