mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-06 18:08:31 +00:00
Fix linking errors with some compilers when MM:S plugins call function in tier1 interface.h. (#34)
This commit is contained in:
parent
c93b3e2d95
commit
f255fa54ff
@ -39,6 +39,10 @@
|
|||||||
#include <ISmmAPI.h>
|
#include <ISmmAPI.h>
|
||||||
#include <ISmmPluginExt.h>
|
#include <ISmmPluginExt.h>
|
||||||
|
|
||||||
|
#ifndef META_NO_HL2SDK
|
||||||
|
#include <tier1/interface.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Interface return status, binary-compatible with HL2SDK's IFACE_OK and IFACE_FAILED.
|
// Interface return status, binary-compatible with HL2SDK's IFACE_OK and IFACE_FAILED.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -437,11 +441,8 @@ using namespace SourceMM;
|
|||||||
* you should not pass a pointer to your plugin's
|
* you should not pass a pointer to your plugin's
|
||||||
* singleton.
|
* singleton.
|
||||||
*/
|
*/
|
||||||
#define PLUGIN_EXPOSE(name, var) \
|
#ifdef META_NO_HL2SDK
|
||||||
ISmmAPI *g_SMAPI = NULL; \
|
#define PL_EXPOSURE_FUNC(name, var) \
|
||||||
ISmmPlugin *g_PLAPI = NULL; \
|
|
||||||
PluginId g_PLID = (PluginId)0; \
|
|
||||||
SourceHook::ISourceHook *g_SHPtr = NULL; \
|
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code) { \
|
SMM_API void *PL_EXPOSURE(const char *name, int *code) { \
|
||||||
if (name && !strcmp(name, METAMOD_PLAPI_NAME)) { \
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME)) { \
|
||||||
return static_cast<void *>(&var); \
|
return static_cast<void *>(&var); \
|
||||||
@ -449,6 +450,21 @@ using namespace SourceMM;
|
|||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
// First param should be actual classname, not iface name, but we don't have that and it doesn't matter here.
|
||||||
|
#define PL_EXPOSURE_FUNC(name, var) EXPOSE_SINGLE_INTERFACE_GLOBALVAR(ISmmPlugin, ISmmPlugin, METAMOD_PLAPI_NAME, var);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PLUGIN_EXPOSE(name, var) \
|
||||||
|
ISmmAPI *g_SMAPI = NULL; \
|
||||||
|
ISmmPlugin *g_PLAPI = NULL; \
|
||||||
|
PluginId g_PLID = (PluginId)0; \
|
||||||
|
SourceHook::ISourceHook *g_SHPtr = NULL; \
|
||||||
|
PL_EXPOSURE_FUNC(name, var)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This should be in one of your header files, if you wish
|
* @brief This should be in one of your header files, if you wish
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user