Files
funnygame/public/tier1/interface.h
2025-12-23 15:03:44 +02:00

31 lines
806 B
C++

#ifndef INTERFACE_H
#define INTERFACE_H
#include "tier0/platform.h"
typedef void *( *CreateInterfaceFn )( const char *szName, int *pReturnCode );
typedef void *( *InstantiateInterfaceFn )( void );
CreateInterfaceFn Plat_GetInterfaceFactory( void *lib );
class CInterfaceRegistry
{
public:
CInterfaceRegistry( InstantiateInterfaceFn fn, const char *szName );
InstantiateInterfaceFn m_CreateFn;
const char *m_szName;
CInterfaceRegistry *m_pNext;
};
#define EXPOSE_INTERFACE( className, interfaceName, versionName ) \
static void *__Create##className##_interface() { return ( interfaceName* )( new className ); }; \
static CInterfaceRegistry __Create##className##_registry( __Create##className##_interface, versionName );
void *CreateInterface( const char *szName, int *pReturnCode );
#endif