Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualnoatom

Posted 08 December 2012 - 02:04 PM

Please excuse my lack of knowledge but I never worked with typedefs too much.Here's the code:

[source lang="cpp"]extern "C" { HRESULT CreateRenderDevice(HINSTANCE hDLL, ZFXRenderDevice **pInterface); typedef HRESULT (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface); HRESULT ReleaseRenderDevice(ZFXRenderDevice **pInterface); typedef HRESULT (*RELEASERENDERDEVICE)(ZFXRenderDevice **pInterface); }[/source]

Now you probably know that this is static & dynamic library releated.

What I don't understand is:
typedef HRESULT (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface);

so what does this mean? (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface) is it a cast or...?
Also we used typedef for what? does this (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface) refer to a HRESULT now?

The release function from the above code is used later like this:

_ReleaseRenderDevice = (RELEASERENDERDEVICE)
GetProcAddress(m_hDLL, "ReleaseRenderDevice");

From the 2 lines above I understand that the returned object from GetProcAddress(m_hDLL, "ReleaseRenderDevice") is casted to RELEASERENDERDEVICE.



Please,some explanations? In the book it doesn't explain too much about dlls and static libraries,knowledge about them is a assumed.

#1noatom

Posted 08 December 2012 - 02:03 PM

Please excuse my lack of knowledge but I never worked with typedefs too much.Here's the code:

[source lang="cpp"]extern "C" { HRESULT CreateRenderDevice(HINSTANCE hDLL, ZFXRenderDevice **pInterface); typedef HRESULT (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface); HRESULT ReleaseRenderDevice(ZFXRenderDevice **pInterface); typedef HRESULT (*RELEASERENDERDEVICE)(ZFXRenderDevice **pInterface); }[/source]

Now you probably know that this is static & dynamic library releated.

What I don't understand is:
typedef HRESULT (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface);

so what does this mean? (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface) is it a cast or...?
Also we used typedef for what? does this (*CREATERENDERDEVICE)(HINSTANCE hDLL, ZFXRenderDevice **pInterface) refer to a HRESULT now?

The release function from the above code is used later like this:

_ReleaseRenderDevice = (RELEASERENDERDEVICE)
GetProcAddress(m_hDLL, "ReleaseRenderDevice");



Please,some explanations? In the book it doesn't explain too much about dlls and static libraries,knowledge about them is a assumed.

PARTNERS