client: use correct export attribute depending on the compiler

This commit is contained in:
Alibek Omarov 2023-09-09 02:55:30 +03:00
parent db368301b2
commit bcf6d80cf8
15 changed files with 36 additions and 35 deletions

View File

@ -99,7 +99,6 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#define DLLEXPORT __declspec( dllexport )
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )

View File

@ -972,7 +972,6 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#define DLLEXPORT __declspec( dllexport )
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
if ( version != STUDIO_INTERFACE_VERSION )

View File

@ -37,8 +37,6 @@ extern "C"
#include "twm.h"
#include "twmmanager.h"
#define DLLEXPORT __declspec( dllexport )
cl_enginefunc_t gEngfuncs;
CHud gHUD;
TheWastesViewport *gViewPort = NULL;

View File

@ -31,7 +31,6 @@ typedef float vec_t;
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "util_vector.h"
#define EXPORT _declspec( dllexport )
#include "../engine/cdll_int.h"
#include "../dlls/cdll_dll.h"

View File

@ -18,8 +18,6 @@
#include "demo_api.h"
#include <memory.h>
#define DLLEXPORT __declspec( dllexport )
int g_demosniper = 0;
int g_demosniperdamage = 0;
float g_demosniperorg[3];

View File

@ -20,8 +20,6 @@
#include "pmtrace.h"
#include "in_defs.h"
#define DLLEXPORT __declspec( dllexport )
void Game_AddObjects( void );
void Game_UpdateObjects(double frametime);

View File

@ -30,6 +30,11 @@
#include "wrect.h"
#include "cl_dll.h"
#include "ammo.h"
#include "exportdef.h"
#ifndef _MSC_VER
#define _cdecl /* nothing here, cdecl is default */
#endif
#define DHN_DRAWZERO 1
#define DHN_2DIGITS 2

View File

@ -9,12 +9,11 @@
#define HUD_IFACEH
#pragma once
#define EXPORT _declspec( dllexport )
#define _DLLEXPORT __declspec( dllexport )
#include "exportdef.h"
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "wrect.h"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;
#endif
#endif

View File

@ -599,6 +599,11 @@ int CompareField( CHudServers::server_t *p1, CHudServers::server_t *p2, const ch
return stricmp( sz1, sz2 );
}
#ifndef _WIN32
#define CALLBACK /* nothing here */
#define __cdecl /* nothing here */
#endif
int CALLBACK ServerListCompareFunc( CHudServers::server_t *p1, CHudServers::server_t *p2, const char *fieldname )
{
if (!p1 || !p2) // No meaningful comparison

View File

@ -16,6 +16,4 @@
// fall over
#define ROLL 2
#define DLLEXPORT __declspec( dllexport )
#endif
#endif

View File

@ -29,8 +29,6 @@
#include "twm.h"
#include "twmmanager.h"
#define DLLEXPORT __declspec( dllexport )
extern "C"
{
#if 0
@ -318,4 +316,4 @@ void DLLEXPORT HUD_StudioEvent( const struct mstudioevent_s *event, struct cl_e
default:
break;
}
}
}

View File

@ -33,8 +33,6 @@
#include "ParticleBase.h"
#define DLLEXPORT __declspec( dllexport )
extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );
@ -361,4 +359,4 @@ void DLLEXPORT HUD_DrawTransparentTriangles( void )
cl_entity_t *attached_ent = clientinfo->attached_ent;
R_TwmModel(clientinfo,attached_ent->attachment[clientinfo->attachment_num],attached_ent->angles);
}
}
}

View File

@ -51,12 +51,6 @@ CBaseEntity
// C functions for external declarations that call the appropriate C++ methods
#ifdef _WIN32
#define EXPORT _declspec( dllexport )
#else
#define EXPORT /* */
#endif
extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
extern "C" EXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );

19
dlls/exportdef.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#if !defined(EXPORTDEF_H)
#define EXPORTDEF_H
#if _WIN32 || __CYGWIN__
#if __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

View File

@ -20,6 +20,7 @@
#include <stdio.h>
#include "custom.h"
#include "cvardef.h"
#include "exportdef.h"
//
// Defines entity interface between engine and DLLs.
// This header file included by engine files and DLL files.
@ -29,13 +30,6 @@
// This is conveniently done for them in extdll.h
//
/* Set up Linux Compile! */
#ifdef _WIN32
#define DLLEXPORT __stdcall
#else
#define DLLEXPORT __attribute__((stdcall)) /* */
#endif
typedef enum
{
at_notice,
@ -186,7 +180,7 @@ typedef struct enginefuncs_s
void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len);
void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch);
CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC);
long (*pfnRandomLong) (long lLow, long lHigh);
int (*pfnRandomLong) (int lLow, int lHigh);
float (*pfnRandomFloat) (float flLow, float flHigh);
void (*pfnSetView) (const edict_t *pClient, const edict_t *pViewent );
float (*pfnTime) ( void );