• Advertisement
Sign in to follow this  

Help with export

This topic is 1859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have a header file like this:

[source lang="cpp"]class ZFXRenderDevice {
HWND m_hWndMain; // application main window
HWND m_hWnd[MAX_3DHWND]; // 3D render window handle
UINT m_nNumhWnd; // number of hwnds in array
UINT m_nActivehWnd; // which one is active (0=main hWnd)
HINSTANCE m_hDLL; // dll module handle
DWORD m_dwWidth; // screen width
DWORD m_dwHeight; // screen height
bool m_bWindowed; // windowed mode?
char m_chAdapter[256]; // graphics adapter name
bool m_bRunning; // after succesful initialization
FILE *m_pLog; // log file

ZFXRenderDevice(void) {};
virtual ~ZFXRenderDevice(void) {};

// ===================

// initialize engine, should first display dialog to select
// graphics adapter and mode, and then start the 3D API
virtual HRESULT Init(HWND, const HWND*, int, int, int, bool)=0;
virtual HRESULT InitWindowed(HWND, const HWND*, int, bool)=0;

// release API specific stuff
virtual void Release(void)=0;

// is initialized?
virtual bool IsRunning(void)=0;

// ================

// switch swap chain to hwnd in array from Init()
virtual HRESULT UseWindow(UINT nHwnd)=0;

// clear buffers and prepare for rendering
virtual HRESULT BeginRendering(bool bClearPixel,
bool bClearDepth,
bool bClearStencil)=0;

// end rendering and flip pixel buffer to front
virtual void EndRendering(void)=0;

// clear pixel-, depth-, stencil-buffer
virtual HRESULT Clear(bool, bool, bool)=0;

// change background color
virtual void SetClearColor(float fRed, float fGreen, float fBlue)=0;
}; // class

typedef class ZFXRenderDevice *LPZFXRENDERDEVICE;

extern "C" {
HRESULT CreateRenderDevice(HINSTANCE hDLL, ZFXRenderDevice **pInterface);

HRESULT ReleaseRenderDevice(ZFXRenderDevice **pInterface);
typedef HRESULT (*RELEASERENDERDEVICE)(ZFXRenderDevice **pInterface);


So when an instance of that class gets created,the variables in it get created too right? But what about that extern "C"? From what I googled I found that those functions are decleared here,but will be implemented somewhere else.
And the typedef? I mean the typedef creates a pointer type called RELEASERENDERDEVICE.

What I don't understand is why put that typedef under extern? Why not just put it above the class?! I mean it's just a definition,it doesn't actually create a RELEASERENDERDEVICE pointer.

Share this post

Link to post
Share on other sites
so the c++ mangling problem affects even function pointers? I thought only functions...

Are you sure that the name mangling problem affects function pointers too?! Edited by noatom

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement