Original Post
Hi there... Im trying to make some dll modules and work with abstract functions(interfaces). Its my first attempt so, maybe the question will be a little dumb, but im not used to OOP as i should be! Well, enough chit chat, the problem is that im receiving an "C2275" error message like that: c:\projetos\p1\anauelrender.h(41) : error C2275: 'CREATERENDERDEVICE' : illegal use of this type as an expression c:\projetos\p1\anauel.h(43) : see declaration of 'CREATERENDERDEVICE' And i think the problem is in the declaration, see below: and then defined as below: I wanna know if there is something wrong about VC++ 6.0 with this type of casting, and what should i do to avoid that error? one more thing... i also used that: typedef struct AnauelRenderer *ANAUELRENDERER; and AnauelRenderer is a class, making the compiler generate this error also: I just placed all of this because i think its all corelacioned. I hope you guys understand the mess i placed behind :)
extern "C"
{
HRESULT CreateRenderDevice(HINSTANCE hDll, AnauEngine **pInterface);
typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDll, AnauEngine **pInterface);
HRESULT ReleaseRenderDevice(AnauEngine **pInterface);
typedef HRESULT (*RELEASERENDERDEVICE) (AnauEngine **pInterface);
}
HRESULT AnauelRenderer::CreateDevice(char *chAPI)
{
char buffer[300];
if(strcmp(chAPI, "d3d") ==0)
{
a_Dll = LoadLibrary("anaueld3d");
if(!a_Dll)
{
MessageBox(NULL, "anaueld3d.dll falhou!", "Anauel - Erro", MB_OK | MB_ICONERROR);
return E_FAIL;
}
}
CREATERENDERDEVICE _CreateRenderDevice = 0;
HRESULT hr;
_CreateRenderDevice (CREATERENDERDEVICE) GetProcAddress(a_Dll, "CreateRenderDevice");
if(!_CreateRenderDevice) return E_FAIL;
hr = _CreateRenderDevice(a_Dll, &a_Device);
if (FAILED(hr))
{
MessageBox(NULL, "CreateRenderDevice da dll falhou!", "Anauel - Erro", MB_OK | MB_ICONERROR);
a_Device = NULL;
return E_FAIL;
}
return S_OK;
}
c:\projetos\p1\anauelrender.h(20) : warning C4099: 'AnauelRenderer' : type name first seen using 'class' now seen using 'struct'
c:\projetos\p1\anauelrender.h(4) : see declaration of 'AnauelRenderer'