cl_dll: add more crossplatform typedefs, defines

This commit is contained in:
Alibek Omarov 2020-08-31 20:21:43 +03:00
parent 7679464869
commit 0a331ca9a4
3 changed files with 24 additions and 5 deletions

View File

@ -17,9 +17,8 @@
// //
#include "cvardef.h" #include "cvardef.h"
#include "port.h"
#define EXPORT _declspec( dllexport ) #include "exportdef.h"
#define DLLEXPORT __declspec( dllexport )
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
@ -135,14 +134,14 @@ extern "C" void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, c
#define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \ #define DECLARE_MESSAGE(y, x) int __MsgFunc_##x(const char *pszName, int iSize, void *pbuf) \
{ \ { \
return gHUD.##y.MsgFunc_##x(pszName, iSize, pbuf ); \ return gHUD.y.MsgFunc_##x(pszName, iSize, pbuf ); \
} }
#define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y ); #define HOOK_COMMAND(x, y) gEngfuncs.pfnAddCommand( x, __CmdFunc_##y );
#define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \ #define DECLARE_COMMAND(y, x) void __CmdFunc_##x( void ) \
{ \ { \
gHUD.##y.UserCmd_##x( ); \ gHUD.y.UserCmd_##x( ); \
} }
#define SPR_Set (*gEngfuncs.pfnSPR_Set) #define SPR_Set (*gEngfuncs.pfnSPR_Set)

View File

@ -87,6 +87,7 @@ GNU General Public License for more details.
typedef unsigned int ULONG; typedef unsigned int ULONG;
typedef int WPARAM; typedef int WPARAM;
typedef unsigned int LPARAM; typedef unsigned int LPARAM;
typedef int BOOL;
typedef void* HANDLE; typedef void* HANDLE;
typedef void* HMODULE; typedef void* HMODULE;

19
dlls/exportdef.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#ifndef EXPORTDEF_H
#define EXPORTDEF_H
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define EXPORT __attribute__ ((dllexport))
#else
#define EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax.
#endif
#else
#if __GNUC__ >= 4
#define EXPORT __attribute__ ((visibility ("default")))
#else
#define EXPORT
#endif
#endif
#define DLLEXPORT EXPORT
#define _DLLEXPORT EXPORT
#endif // EXPORTDEF_H