X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=libs%2Fwatt32%2Fsys%2Fw32api.h;fp=libs%2Fwatt32%2Fsys%2Fw32api.h;h=3770f7e6a42cba0ae95a168913691d8ce2285df6;hb=214a070238552de6167bbf506cbc23006969a182;hp=0000000000000000000000000000000000000000;hpb=d3c8a942b99443abf0c11d9759994022ed6da597;p=oftp diff --git a/libs/watt32/sys/w32api.h b/libs/watt32/sys/w32api.h new file mode 100644 index 0000000..3770f7e --- /dev/null +++ b/libs/watt32/sys/w32api.h @@ -0,0 +1,71 @@ +/*!\file sys/w32api.h + * + * Watt-32 API decoration for Win32 targets. + */ +#ifndef __SYS_W32API_H +#define __SYS_W32API_H + +#if !defined(_WATT32_FAKE_WINSOCK_H) && (defined(_WINSOCK_H) || defined(_WINSOCKAPI_)) + #error Never include the real in Watt-32 programs. + #error Change your include-path so the fake gets included first. +#endif + +#if !defined(_WATT32_FAKE_WINSOCK2_H) && (defined(_WINSOCK2_H) || defined(_WINSOCK2API_)) + #error Never include the real in Watt-32 programs. + #error Change your include-path so the fake gets included first. +#endif + +#if !defined(_WATT32_FAKE_WS2TCPIP_H) && defined(_WS2TCPIP_H) + #error Never include the real in Watt-32 programs. + #error Change your include-path so the fake gets included first. +#endif + +#if defined(WIN32) || defined(_WIN32) + /* Don't include the real */ + #define _WINSOCKAPI_ + #define _WINSOCK2API_ + #define _WINSOCK_H + #define _WINSOCK2_H + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + #include +#endif + +/* + * For non-Win32 targets the .\util\mkimp program (a small C-preprocessor) + * is meant to search all headers for W32_FUNC/W32_DATA prefixes. All + * functions with a W32_FUNC prefix will produce an export stub function. + * See dj_dxe.mak. Very experimental at the moment. + * + * Note: only a small subset of the Winsock extensions are implemented in + * watt-32.dll (hardly any WSA*() functions yet). + */ +#if (defined(WIN32) || defined(_WIN32)) && !defined(WATT32_STATIC) + #if defined(WATT32_BUILD) + #define W32_FUNC extern __declspec(dllexport) + #define W32_DATA extern __declspec(dllexport) + #else + #define W32_FUNC extern __declspec(dllimport) + #define W32_DATA extern __declspec(dllimport) + #endif +#else + #define W32_FUNC extern + #define W32_DATA extern +#endif + +/* + * W32_CALL is *not* defined to `stdcall' due to a bug in MingW's + * linker. This bug prevents a MingW generated WATT-32.DLL from + * being used by e.g. a MSVC program. + * Ref. http://sources.redhat.com/bugzilla/show_bug.cgi?id=351 + * (last paragraph) + */ +#if (defined(WIN32) || defined(_WIN32)) && 0 + #define W32_CALL __stdcall /* maybe __fastcall instead for MSVC? */ +#else + #define W32_CALL +#endif + +#endif +