Browse Source

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

foolsday
mittorn 9 years ago
parent
commit
9fd279a974
  1. 5
      cl_dll/GameStudioModelRenderer.cpp
  2. 2
      cl_dll/GameStudioModelRenderer_Sample.cpp
  3. 7
      cl_dll/cdll_int.cpp
  4. 5
      cl_dll/cl_dll.h
  5. 2
      cl_dll/cl_util.h
  6. 8
      cl_dll/demo.cpp
  7. 6
      cl_dll/entity.cpp
  8. 10
      cl_dll/hud_iface.h
  9. 2
      cl_dll/in_defs.h
  10. 8
      cl_dll/tri.cpp
  11. 28
      dlls/cbase.h
  12. 18
      dlls/exportdef.h
  13. 5
      dlls/h_export.cpp
  14. 15
      dlls/util.h

5
cl_dll/GameStudioModelRenderer.cpp

@ -99,11 +99,6 @@ HUD_GetStudioModelInterface @@ -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 )

2
cl_dll/GameStudioModelRenderer_Sample.cpp

@ -972,7 +972,7 @@ HUD_GetStudioModelInterface @@ -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 )

7
cl_dll/cdll_int.cpp

@ -29,13 +29,6 @@ extern "C" @@ -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;

5
cl_dll/cl_dll.h

@ -31,13 +31,14 @@ typedef float vec_t; @@ -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;

2
cl_dll/cl_util.h

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

8
cl_dll/demo.cpp

@ -18,12 +18,6 @@ @@ -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];
@ -104,4 +98,4 @@ void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer ) @@ -104,4 +98,4 @@ void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );
break;
}
}
}

6
cl_dll/entity.cpp

@ -20,12 +20,6 @@ @@ -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 );

10
cl_dll/hud_iface.h

@ -9,17 +9,11 @@ @@ -9,17 +9,11 @@
#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"
#include "../engine/cdll_int.h"
extern cl_enginefunc_t gEngfuncs;
#endif
#endif

2
cl_dll/in_defs.h

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

8
cl_dll/tri.cpp

@ -17,12 +17,6 @@ @@ -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 );
@ -125,4 +119,4 @@ void DLLEXPORT HUD_DrawTransparentTriangles( void ) @@ -125,4 +119,4 @@ void DLLEXPORT HUD_DrawTransparentTriangles( void )
#if defined( TEST_IT )
// Draw_Triangles();
#endif
}
}

28
dlls/cbase.h

@ -51,11 +51,7 @@ CBaseEntity @@ -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 );
@ -373,15 +369,15 @@ public: @@ -373,15 +369,15 @@ public:
#else
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (a)
#define SetTouch( a ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
#define SetUse( a ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (a)
#define SetBlocked( a ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
#define ResetThink( ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (NULL)
#define ResetTouch( ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#define ResetUse( ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (NULL)
#define ResetBlocked( ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (a)
#define SetTouch( a ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
#define SetUse( a ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (a)
#define SetBlocked( a ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a)
#define ResetThink( ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (NULL)
#define ResetTouch( ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#define ResetUse( ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (NULL)
#define ResetBlocked( ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
#endif
@ -557,8 +553,8 @@ public: @@ -557,8 +553,8 @@ public:
// the button will be allowed to operate. Otherwise, it will be
// deactivated.
};
#define SetMoveDone( a ) m_pfnCallWhenMoveDone = static_cast <void (CBaseToggle::*)(void)> (a)
#define SetMoveDone( a ) m_pfnCallWhenMoveDone = static_cast <void (CBaseToggle::*)(void)> (a)
// people gib if their health is <= this at the time of death

18
dlls/exportdef.h

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

5
dlls/h_export.cpp

@ -47,7 +47,10 @@ BOOL WINAPI DllMain( @@ -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;

15
dlls/util.h

@ -27,9 +27,9 @@ @@ -27,9 +27,9 @@
#include "physcallback.h"
#endif
#include <string.h>
#include <ctype.h>
#include <string.h>
#include <ctype.h>
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent ); // implementation later in this file
extern globalvars_t *gpGlobals;
@ -92,13 +92,8 @@ typedef int BOOL; @@ -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 ); }
//

Loading…
Cancel
Save