C - add elements to struct by define

Posted by CodeStepper on Stack Overflow See other posts from Stack Overflow or by CodeStepper
Published on 2014-05-31T09:21:54Z Indexed on 2014/05/31 9:25 UTC
Read the original article Hit count: 160

Filed under:
|
|
|
|

I have a problem. I'm trying to add struct elements by previously defined constant. This is sample code (OpenGL+WinAPI)

#define ENGINE_STRUCT \
    HGLRC       RenderingContext;\
    HDC         DeviceContext;

And then:

typedef struct SWINDOW {

    ENGINE_STRUCT

    HWND        Handle;
    HINSTANCE   Instance;
    CHAR*       ClassName;
    BOOL        Fullscreen;
    BOOL        Active;
    MSG         Message;
} WINDOW;

Is this possible? Thanks in advance.

© Stack Overflow or respective owner

Related posts about c

    Related posts about winapi