For now though I've decided to press on with the reason I decided to get better at C++ in the first place - my game engine book.
Check out the following code:
extern "C"{ HRESULT CreateRenderDevice(HINSTANCE hDLL, ZFXRenderDevice** pInterface); typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDLL, ZFXRenderDevice** pInterface); HRESULT ReleaseRenderDevice(ZFXRenderDevice** pInterface); typedef HRESULT (*RELEASERENDERDEVICE) (ZFXRenderDevice** pInterface);}
1)The extern keyword if I remember correctly has some effect on the compiler. I think it is necessary to have these things declared here so the file can be compiled but they cannot fully 'exist' here or there will be (I think) a linker problem where it finds two things where it should only find one and cannot resolve the discprency. I'd appreciate it if anyone can tell me if I'm correct here. Thanks.
2)WHat does the "C" part do? The author states that this "exports the functions in plain C-style without C++ name mangling" - "The overhead of object orientation forces C++ to twist around the function names and parameter lists a bit, but we don't want to worry about that and so we enforce plain C usage of those functions here". WHAT? So is he suggesting that there is some inherent flaw within C++ and C++ compilers that makes the basic functional modus operandi of the language useless without clever tricks and hacks? I don't think so somehow. SO what is he trying to achieve here? And what does any of that mean?
3)
typedef HRESULT (*CREATERENDERDEVICE) (HINSTANCE hDLL, ZFXRenderDevice** pInterface);
I don't understand this line? What is he typedef'ing here? I don't understand what the subject of the typedef is. Is it the function pointer or the argument list or what? Is somehow just doesn't look like a typical typedef statement to me.That's it for now. ANy help anyone can offer would be appreicated cheers! :oD