MinGW problem with WLOOP in DirectMusic

Building a small DirectX application with MinGW I ran into this error (again):

C:/DXSDK/include/dmdls.h:81: error: declaration of `WLOOP _DMUS_REGION::WLOOP[1]'
C:/DXSDK/include/dls1.h:264: error: changes meaning of `WLOOP' from `typedef struct _rloop WLOOP'

I encountered this a few years ago (and completely forgot about it… almost). It took me a while to dig up the forum post where I had originally posted the solution to this problem. I’m bringing it back here so I can find it more easily.

WLOOP is typedef’ed in dls1.h as:

typedef struct _rloop {
    ULONG cbSize;
    ULONG ulType; /* Loop Type */
    ULONG ulStart; /* Start of loop in samples */
    ULONG ulLength; /* Length of loop in samples */
} WLOOP, FAR *LPWLOOP;

The WLOOP type is used in a struct in dmdls.h:

typedef struct _DMUS_REGION
{
    RGNRANGE RangeKey;
    RGNRANGE RangeVelocity;
    USHORT fusOptions;
    USHORT usKeyGroup;
    ULONG ulRegionArtIdx;
    ULONG ulNextRegionIdx; /* If zero no more regions */
    ULONG ulFirstExtCkIdx;
    WAVELINK WaveLink;
    WSMPL WSMP;
    WLOOP WLOOP[1];
} DMUS_REGION;

It seems MinGW doesn’t like the member variable with the same name as its type. I changed the definition of the WLOOP member variable to use the actual type rather than the typedef’ed alias:

typedef struct _DMUS_REGION
{
    ...
    // WLOOP WLOOP[1];
    struct _rloop WLOOP[1];
} DMUS_REGION;

Hope this helps.

Tags: , , , , , , ,

Tuesday, October 25th, 2011 DirectX, Graphics, Programming

Leave a Reply

 

Comments are moderated due to spammers. Your comments will not appear until I review and approve them. If you left a question I will answer as best I can so be sure to check back.