Issue regarding template speciliazation
I have the following piece of code (at the bottom). When i try to compile the following code i get an error ( error: specialization of 'HRESULT MakeSimple<PrimT>::marshal1(SimpleStream *) [with PrimT = double]' after instantiation error: invalid function declaration ) if i put the ifdef __GNUC__ block at the beginning but if I move the block at the end i.e. after the declaration of the function marshal1 and unmarshal1 the code compiles fine.
I am not sure what purpose the line of code ''template class MakeSimple<double>;" serves, whether it is a forward declaration or a is an instantiation of the class.
Can you please throw some light on this matter.
Thanks a lot in advance for your help.
ifdef __GNUC__
template class MakeSimple<double>;
endif
static int caseDouble (SimpleStream * pStrm, double * value)
{
pStrm->align (sizeof (double));
pStrm->insert (sizeof (long), true);
return pStrm->insert (sizeof (long), true);
}
template<> int NdrSimple<double>::marshal1 (SimpleStream * pStrm)
{
return caseDouble(pStrm, m_pValue);
}
static int ncaseDouble (SimpleStream * pStrm, double * value)
{
pStrm->align (sizeof (double));
pStrm->extract (sizeof (long), true);
int hr = pStrm->extract (sizeof (long), true);
return hr;
}
template<> int MakeSimple<double>::unmarshal1 (SimpleStream * pStrm)
{
return ncaseDouble(pStrm, m_pValue);
}

