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]

[Bug c++/46097] Switch to warn of global variables in a C++ shared object


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46097

--- Comment #24 from Jeffrey Walton <noloader at gmail dot com> 2010-10-22 01:59:34 UTC ---
Hi Jonathan,

(In reply to comment #16)
> (In reply to comment #13)
> > 
> > [SNIP]
> 
> There are a number of options for making sure the global is private to the
> library, thus avoiding multiple definitions of the same object when two copies
> of the code are linked to.
>
> ...
> 
> * You can put it in an anonymous namespace.
Would namespaces be via dlmopen? (I've been trying to figure out how a c++
namespace could help, but I think I went down a rabbit hole).

http://linux.die.net/include/dlfcn.h:
/* Like `dlopen', but request object to be allocated in a new namespace. */
extern void *dlmopen (Lmid_t __nsid, __const char *__file, int __mode);

Jeff


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