Unlike say Swift generics, C++ templates is purely compile time feature. There's no direct support for it in C++ ABI. Hence, in short, you cannot create an opaque (pre-compiled) shared library with C++ templates, to be used with random unknown template parameters by a client code.