Hi,
I have am having trouble using template classes in rcpp. The compiling process
works just fine, but there are errors on link. It seems as if the methods are
not getting specialized.
The Error:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so,
6): Symbol not found: __ZN5gergm9BinaryNetINS_14DirectedVertexEE4sizeEv
Referenced from:
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so
Expected in: flat namespace
in
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/gergm/libs/x86_64/gergm.so
Error: loading failed
Execution halted
ERROR: loading failed
The basic form of the class is:
template<class T>
class BinaryNet{
public:
int size();
};
template<class T>
void BinaryNet<T>::size(){return 1;}
BinaryNet is called in a function in a separate c++ file. If I explicitly add
the specialization, then everything works out fine
template<>
void BinaryNet<DirectedVertex>::size(){return 1;}
How can I make sure that these specializations are created. I apologize if this
is more a c++ question than an Rcpp one.
Best,
Ian
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel