www.digitalmars.com         C & C++   DMDScript  

c++ - template libraries

// file 1
template<class T>
struct A
{
  void f();
};

template<class T>
void A<T>::f()
{ }

template class A<bool>;


compile and create a static library:
dmc -c file1.cpp
lib -c mylib.lib file1.cpp


// file 1
template<class T>
struct A
{
  void f();
};

int main()
{
  A<bool> a;

  a.f();

  return 0;
}

trying to link with mylib1.lib:

Warning 140: Library probably needs FIXLIB 
Error 42: Symbol Undefined ?f ?$A _N  QAEXXZ


Looks familiar, but this time I would consider it a bug. And STLport expects
that it can use template instantiations from a library.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Jan 04 2003