So I've got this little macro I wrote up to add some pointer functions into a database, the only problem is it isn't happy with it at all. The Macro iss....
#define CREATE_ENT_LINK( index, className, entName ) \
static void * insert##className ( void ) \
{ \
return (new C##className); \
} \
static void className##Live ( void * address) \
{ \
C##className *temp = (C##className*)address; \
temp->live(); \
} \
static void className##Draw ( void * address ) \
{ \
C##className *temp = (C##className*)address; \
temp->Draw(); \
} \
class C##className##DataEntry \
{ \
public: \
C##className##DataEntry() \
{ \
HMDFunc::entData.addEntry( index, #entName, &insert##className, &className##Live, &className##Draw); \
} \
}; \
static C##className##DataEntry invoke;
Which I'm calling in a namespace down further in the program. addEntry is defined as...
void CEntInfo::addEntry(int ID, std::string entName, entFactory factory, entCast casterLive, entCast casterDraw)
{
CEntClassCreation * temp = new CEntClassCreation(ID, entName, factory, casterLive, casterDraw);
if (!entClassDictionary.contains(temp))
entClassDictionary.append(temp);
}
Not too much to that. And I have two typedefs for the pointer functions, which is where I think the problem is..
typedef void * (*entFactory)();
typedef void (*entCast)();
The compile error, which I'm getting 4 times, reads..
error C2664: 'CEntInfo::addEntry' : cannot convert parameter 4 from 'void (__cdecl *)(void *)' to 'entCast'
Considering the fact that I have never worked with pointer functions before I haven't got a clue as to how to fix this. I've poked around google, but can't find anything I can understand. Halp?
EDIT: Nevermind, I got a work around.