help-gplusplus
[Top][All Lists]
Advanced

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

Re: Static member functions in template classes and inlining


From: Paul Pluzhnikov
Subject: Re: Static member functions in template classes and inlining
Date: Thu, 22 Jun 2006 15:25:08 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"tchernobog" <msettenvini@gmail.com> writes:

> So, how can i get the symbols for Singleton<SomeClass> to be marked "T"
> (global exported symbols into the text section) in libbackend.so and
> "U" (undefined) in the main executable and modules?

Remove the definition of Singleton<T>::get_instance() from the
body of the class in Singleton.h header, and put it into a separate
Singleton.tc file.

Then '#include "Singleton.tc"' only into the compilation units
where you want the Singleton<SomeClass>::get_instance() to be
defined.

After that, you'll get a 'W' in libbackend.so, and a 'U' everywhere
else, which should be good enough.

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]