I have a number of function pointers declared in a header file where the functions the pointers point to are assigned in a cpp file (depending on endianness).
For the non-template functions I just declare them as extern and everything works fine, like so:
parse.h
extern int32(*parseWord)(byte**);
parse.cpp
int32(*parseWord)(byte**) = IS_BIG_ENDIAN ? &pWordBE : &pWordLE;
For templated function pointers I assumed I could do the same:
parse.h
template<typename T>
extern T(*parse)(byte**);
parse.cpp
template<typename T>
T (*parse)(byte**) = IS_BIG_ENDIAN ? &pBE<T> : &pLE<T>;
But the above results in undefined references.
Is there a way of doing this kind of forward declaration?