Hello,

I have the following:

typedef struct tagKEYBDINPUT {
   WORD wVk;
   WORD wScan;
   DWORD dwFlags;
   DWORD time;
   ULONG_PTR dwExtraInfo;
} KEYBDINPUT, *PKEYBDINPUT;

typedef struct tagINPUT {
 DWORD type;
 union {MOUSEINPUT mi;
           KEYBDINPUT ki;
           HARDWAREINPUT hi;
          };
}INPUT, *PINPUT;

and in a chs file:

sendChar :: HWND -> Char -> IO ()
sendChar win ch = do
                     allocaBytes ( {#sizeof INPUT#}) $ \ptr ->
                       {#set INPUT.type #} ptr 0
                       {#set INPUT.ki.wVk #} ptr 0
                       {#set INPUT.ki.dwFlags #} ptr 0

c2hs comes up with


Test1.chs:27: (column 37) [ERROR]  >>> error
 Unknown member name!
 The structure has no member called `ki'.  The structure is defined at
 ("sendinput.h",35,9).
Test1.chs:26: (column 37) [ERROR]  >>> error
 Unknown member name!
 The structure has no member called `ki'.  The structure is defined at
 ("sendinput.h",35,9).

How do I address fields inside the union?

Cheers

Mark

_______________________________________________
C2hs mailing list
C2hs@haskell.org
http://www.haskell.org/mailman/listinfo/c2hs

Reply via email to