207 |
mateuszvis |
1 |
/*!\file sys/w32api.h
|
|
|
2 |
*
|
|
|
3 |
* Watt-32 API decoration for Win32 targets.
|
|
|
4 |
*/
|
|
|
5 |
#ifndef __SYS_W32API_H
|
|
|
6 |
#define __SYS_W32API_H
|
|
|
7 |
|
|
|
8 |
#if !defined(_WATT32_FAKE_WINSOCK_H) && (defined(_WINSOCK_H) || defined(_WINSOCKAPI_))
|
|
|
9 |
#error Never include the real <winsock.h> in Watt-32 programs.
|
|
|
10 |
#error Change your include-path so the fake <winsock.h> gets included first.
|
|
|
11 |
#endif
|
|
|
12 |
|
|
|
13 |
#if !defined(_WATT32_FAKE_WINSOCK2_H) && (defined(_WINSOCK2_H) || defined(_WINSOCK2API_))
|
|
|
14 |
#error Never include the real <winsock2.h> in Watt-32 programs.
|
|
|
15 |
#error Change your include-path so the fake <winsock2.h> gets included first.
|
|
|
16 |
#endif
|
|
|
17 |
|
|
|
18 |
#if !defined(_WATT32_FAKE_WS2TCPIP_H) && defined(_WS2TCPIP_H)
|
|
|
19 |
#error Never include the real <ws2tcpip.h> in Watt-32 programs.
|
|
|
20 |
#error Change your include-path so the fake <ws2tcpip.h> gets included first.
|
|
|
21 |
#endif
|
|
|
22 |
|
|
|
23 |
#if defined(WIN32) || defined(_WIN32)
|
|
|
24 |
/* Don't include the real <winsock*.h> */
|
|
|
25 |
#define _WINSOCKAPI_
|
|
|
26 |
#define _WINSOCK2API_
|
|
|
27 |
#define _WINSOCK_H
|
|
|
28 |
#define _WINSOCK2_H
|
|
|
29 |
#ifndef WIN32_LEAN_AND_MEAN
|
|
|
30 |
#define WIN32_LEAN_AND_MEAN
|
|
|
31 |
#endif
|
|
|
32 |
#include <windows.h>
|
|
|
33 |
#endif
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
* For non-Win32 targets the .\util\mkimp program (a small C-preprocessor)
|
|
|
37 |
* is meant to search all headers for W32_FUNC/W32_DATA prefixes. All
|
|
|
38 |
* functions with a W32_FUNC prefix will produce an export stub function.
|
|
|
39 |
* See dj_dxe.mak. Very experimental at the moment.
|
|
|
40 |
*
|
|
|
41 |
* Note: only a small subset of the Winsock extensions are implemented in
|
|
|
42 |
* watt-32.dll (hardly any WSA*() functions yet).
|
|
|
43 |
*/
|
|
|
44 |
#if (defined(WIN32) || defined(_WIN32)) && !defined(WATT32_STATIC)
|
|
|
45 |
#if defined(WATT32_BUILD)
|
|
|
46 |
#define W32_FUNC extern __declspec(dllexport)
|
|
|
47 |
#define W32_DATA extern __declspec(dllexport)
|
|
|
48 |
#else
|
|
|
49 |
#define W32_FUNC extern __declspec(dllimport)
|
|
|
50 |
#define W32_DATA extern __declspec(dllimport)
|
|
|
51 |
#endif
|
|
|
52 |
#else
|
|
|
53 |
#define W32_FUNC extern
|
|
|
54 |
#define W32_DATA extern
|
|
|
55 |
#endif
|
|
|
56 |
|
|
|
57 |
/*
|
|
|
58 |
* W32_CALL is *not* defined to `stdcall' due to a bug in MingW's
|
|
|
59 |
* linker. This bug prevents a MingW generated WATT-32.DLL from
|
|
|
60 |
* being used by e.g. a MSVC program.
|
|
|
61 |
* Ref. http://sources.redhat.com/bugzilla/show_bug.cgi?id=351
|
|
|
62 |
* (last paragraph)
|
|
|
63 |
*/
|
|
|
64 |
#if (defined(WIN32) || defined(_WIN32)) && 0
|
|
|
65 |
#define W32_CALL __stdcall /* maybe __fastcall instead for MSVC? */
|
|
|
66 |
#else
|
|
|
67 |
#define W32_CALL
|
|
|
68 |
#endif
|
|
|
69 |
|
|
|
70 |
#endif
|
|
|
71 |
|