I'm trying to create a proxy class for delayed load of a shared library.
One of the API function of the library is:
int AttachCWnd(CWnd* pControl);
So, I created a macro to easily declare and route calls from the proxy class to the library:
class CLibProxy {
public:
typedef int (*tAttachCWnd)(CWnd*);
tAttachCWnd m_fAttachCWnd;
};
#define DECL_ROUTE(name, ret, args) \
ret CLibProxy::name args \
{ \
if (m_hDLL) \
return m_f##name (args); \
return ret(); \
}
DECL_ROUTE(AttachCWnd, int, (CWnd* pControl));
But compilation fails on VS2010:
error C2275: 'CWnd' : illegal use of this type as an expression
Can anyone explain why?