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. 6
      cl_dll/demo.cpp
  7. 6
      cl_dll/entity.cpp
  8. 8
      cl_dll/hud_iface.h
  9. 2
      cl_dll/in_defs.h
  10. 6
      cl_dll/tri.cpp
  11. 6
      dlls/cbase.h
  12. 18
      dlls/exportdef.h
  13. 5
      dlls/h_export.cpp
  14. 9
      dlls/util.h

5
cl_dll/GameStudioModelRenderer.cpp

@ -99,11 +99,6 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects. 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 ) 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 ) if ( version != STUDIO_INTERFACE_VERSION )

2
cl_dll/GameStudioModelRenderer_Sample.cpp

@ -972,7 +972,7 @@ HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects. 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 ) 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 ) if ( version != STUDIO_INTERFACE_VERSION )

7
cl_dll/cdll_int.cpp

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

5
cl_dll/cl_dll.h

@ -31,13 +31,14 @@ typedef float vec_t;
typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf); typedef int (*pfnUserMsgHook)(const char *pszName, int iSize, void *pbuf);
#include "util_vector.h" #include "util_vector.h"
#define EXPORT _declspec( dllexport )
#include "../engine/cdll_int.h" #include "../engine/cdll_int.h"
#include "../dlls/cdll_dll.h" #include "../dlls/cdll_dll.h"
#ifndef __MSC_VER
#define _cdecl #define _cdecl
#endif
#include "exportdef.h"
#include <string.h> #include <string.h>
extern cl_enginefunc_t gEngfuncs; extern cl_enginefunc_t gEngfuncs;

2
cl_dll/cl_util.h

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

6
cl_dll/demo.cpp

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

6
cl_dll/entity.cpp

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

8
cl_dll/hud_iface.h

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

2
cl_dll/in_defs.h

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

6
cl_dll/tri.cpp

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

6
dlls/cbase.h

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

18
dlls/exportdef.h

@ -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(
return TRUE; 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)); memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals; gpGlobals = pGlobals;

9
dlls/util.h

@ -92,13 +92,8 @@ typedef int BOOL;
// This is the glue that hooks .MAP entity class names to our CPP classes // 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 _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 // The function is used to intialize / allocate the object for the entity
#ifdef _WIN32
#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \ #define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" EXPORT void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); }
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
// //

Loading…
Cancel
Save