Mail Archives: djgpp/1996/06/14/04:48:31
"A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk> wrote:-
> I am having a go at using RSX to compile Windows applications with djgpp.
> ... WinMain called CreateWindow() and then went into a message loop. ...
> CreateWindow() obstinately persisted in returning zero to say that it
> couldn't create a window. ...
After I commented out the line `#define STRICT' , the program ran OK. I think
I know what happened. My WINDOWS.H has this:-
#define pk __attribute__((packed))
...
#if defined(STRICT)&&!defined(_GNUC_)
typedef const void NEAR* HANDLE;
#define DECLARE_HANDLE(name) \
struct name##__ {int unused pk;}; typedef const struct name##__ NEAR* name
#define DECLARE_HANDLE32(name) \
struct name##__ {int unused pk;}; typedef const struct name##__ FAR* name
#else /* STRICT */
typedef UINT HANDLE;
#define DECLARE_HANDLE(name) typedef UINT name
#define DECLARE_HANDLE32(name) typedef DWORD name
#endif /* !STRICT */
where a HANDLE is an int or a NEAR*, which are both 2 bytes (in Windows
compilers), and a HANDLE32 is a long or a FAR*, which are both 4 bytes. But
djgpp treats NEAR* and FAR* the same, as RSX #defines NEAR and FAR as null,
and in STRICT mode a HANDLE used as an element of a struct gets 4 bytes and
not 2, throwing everything out.
- Raw text -