Hi All,
I need a confirmation that what I do is perfectly correct and I need to learn documents that confirm that.
I have a template class (template <class T> class C) which is defined in the shared library "a". Some of the methods of the class C are specialized/defined explicitly for some particular type (ex:int) in the same shared library "a" and an object of C<int> is constructed in this library as well. One method ( ex: void C::f() ) is not specialized explicitly for type int in library "a" but specialized in another shared library "b". Just in case: C<T>::f() has some compilable definition for any type T, ex: template<class T> void C<T>::f(){}.

The simplified code can look like this:
Code:
--------------------------
foo.h:
template <class T> class C {
public:
  void f()
  {
  }
  int aaa(int bbb)
  {
	return bbb + 88;
  }
};
--------------------------
foobar_a.cpp
#include "foo.h"
template <> int C<int>::aaa(int bbb)
{
  return -555 - bbb;
}
C<int> global_c;
--------------------------
foobar_b.cpp
#include "foo.h"
#include "stdlib.h"
template <> void C<int>::f()
{
  exit(3);
}
--------------------------
main_a.cpp
#include "foo.h"

extern C<int> global_c;

int main()
{
  global_c.f();
  return 0;
}
--------------------------
foobar_a.cpp belongs to some shared/dynamic library "a".
foobar_b.cpp belongs to some shared/dynamic library "b".
main_a.cpp is either belongs to shared library "a" or linked to "a" anyhow.

In the sample above neither of functions aaa(int) is needed and can actually be ignored.

Shared library "b" may be linked to shared library "a" or maybe not linked depending on some particular application.
I see that for the applications which have no "b" linked to "a" the default/generic implementation of f() is called ( which is defined in foo.h ). However for the applications which link "b" (dynamically) to "a" the explicitly defined specialization C<int>::f() is called ( which is defined in foobar_b.cpp ). I think that this is a proper and expected behavior however I need some document that confirms/profs that, ex: c++ standard or g++ documentation or something else.

Is it standard behavior? Is it documented somewhere? Where?
I'm using gcc under linux and the code is compiled for FreeBSD.

Thanks,
Boris