2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 19:29:13 +01:00

Fix DLLEXPORT macro and move it's defination to separate file

This commit is contained in:
mittorn 2016-03-09 17:11:16 +06:00
parent f2ea272c02
commit 9fd279a974
14 changed files with 48 additions and 73 deletions

View File

@ -99,11 +99,6 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#endif
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,7 @@ 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

@ -29,13 +29,6 @@ extern "C"
#include <string.h>
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#endif
cl_enginefunc_t gEngfuncs;
CHud gHUD;
mobile_engfuncs_t *gMobileEngfuncs = NULL;

View File

@ -31,13 +31,14 @@ 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"
#ifndef __MSC_VER
#define _cdecl
#endif
#include "exportdef.h"
#include <string.h>
extern cl_enginefunc_t gEngfuncs;

View File

@ -15,7 +15,7 @@
//
// cl_util.h
//
#include "exportdef.h"
#include "cvardef.h"
#ifndef TRUE

View File

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

View File

@ -20,12 +20,6 @@
#include "pmtrace.h"
#include "pm_shared.h"
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#endif
void Game_AddObjects( void );

View File

@ -9,13 +9,7 @@
#define HUD_IFACEH
#pragma once
#ifdef _WIN32
#define EXPORT _declspec( dllexport )
#define _DLLEXPORT __declspec( dllexport )
#else
#define EXPORT
#define _DLLEXPORT
#endif
#include "exportdef.h"
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "wrect.h"

View File

@ -17,9 +17,7 @@
#define ROLL 2
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
typedef struct point_s{
int x;
int y;

View File

@ -17,12 +17,6 @@
#include "cl_entity.h"
#include "triangleapi.h"
#ifdef _WIN32
#define DLLEXPORT __declspec( dllexport )
#else
#define DLLEXPORT
#endif
extern "C"
{
void DLLEXPORT HUD_DrawNormalTriangles( void );

View File

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

18
dlls/exportdef.h Normal file
View File

@ -0,0 +1,18 @@
#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

View File

@ -47,7 +47,10 @@ BOOL WINAPI DllMain(
return TRUE;
}
void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) __attribute__((__stdcall__)) ;
extern "C" void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;

View File

@ -92,13 +92,8 @@ typedef int BOOL;
// This is the glue that hooks .MAP entity class names to our CPP classes
// The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress()
// The function is used to intialize / allocate the object for the entity
#ifdef _WIN32
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \
extern "C" _declspec( dllexport ) void mapClassName( entvars_t *pev ); \
void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
#else
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
#endif
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" EXPORT void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
//