From e7dd11d7158c69861d86f2887d92e29ec6f6492d Mon Sep 17 00:00:00 2001 From: Masterkatze Date: Sat, 6 Jun 2026 16:52:46 +0300 Subject: [PATCH 1/2] Move DLL_EXT_STRING define to limit its scope --- src/game/client/cdll_client_int.cpp | 2 ++ src/game/server/gameinterface.cpp | 2 ++ src/public/filesystem_init.cpp | 2 ++ src/public/tier0/basetypes.h | 1 - src/tier1/interface.cpp | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/client/cdll_client_int.cpp b/src/game/client/cdll_client_int.cpp index 1a58d6f11a..b71354d9ea 100644 --- a/src/game/client/cdll_client_int.cpp +++ b/src/game/client/cdll_client_int.cpp @@ -490,6 +490,8 @@ class CClientDLLSharedAppSystems : public IClientDLLSharedAppSystems public: CClientDLLSharedAppSystems() { + #define DLL_EXT_STRING DLLExtTokenPaste2( _DLL_EXT ) + AddAppSystem( "soundemittersystem" DLL_EXT_STRING, SOUNDEMITTERSYSTEM_INTERFACE_VERSION ); AddAppSystem( "scenefilecache" DLL_EXT_STRING, SCENE_FILE_CACHE_INTERFACE_VERSION ); } diff --git a/src/game/server/gameinterface.cpp b/src/game/server/gameinterface.cpp index 0019a2912c..3890342c41 100644 --- a/src/game/server/gameinterface.cpp +++ b/src/game/server/gameinterface.cpp @@ -3497,6 +3497,8 @@ class CServerDLLSharedAppSystems : public IServerDLLSharedAppSystems public: CServerDLLSharedAppSystems() { + #define DLL_EXT_STRING DLLExtTokenPaste2( _DLL_EXT ) + AddAppSystem( "soundemittersystem" DLL_EXT_STRING, SOUNDEMITTERSYSTEM_INTERFACE_VERSION ); AddAppSystem( "scenefilecache" DLL_EXT_STRING, SCENE_FILE_CACHE_INTERFACE_VERSION ); } diff --git a/src/public/filesystem_init.cpp b/src/public/filesystem_init.cpp index 4fe72d40c4..f471afca2d 100644 --- a/src/public/filesystem_init.cpp +++ b/src/public/filesystem_init.cpp @@ -1281,6 +1281,8 @@ FSReturnCode_t FileSystem_GetFileSystemDLLName( char *pFileSystemDLL, int nMaxLe if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) ) return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." ); + #define DLL_EXT_STRING DLLExtTokenPaste2( _DLL_EXT ) + // Assume we'll use local files Q_snprintf( pFileSystemDLL, nMaxLen, "%s%cfilesystem_stdio" DLL_EXT_STRING, executablePath, CORRECT_PATH_SEPARATOR ); diff --git a/src/public/tier0/basetypes.h b/src/public/tier0/basetypes.h index e141f0573a..b522cd4a02 100644 --- a/src/public/tier0/basetypes.h +++ b/src/public/tier0/basetypes.h @@ -21,7 +21,6 @@ // This is a trick to get the DLL extension off the -D option on the command line. #define DLLExtTokenPaste(x) #x #define DLLExtTokenPaste2(x) DLLExtTokenPaste(x) -#define DLL_EXT_STRING DLLExtTokenPaste2( _DLL_EXT ) #include "protected_things.h" diff --git a/src/tier1/interface.cpp b/src/tier1/interface.cpp index ee4d995205..b00afe38c1 100644 --- a/src/tier1/interface.cpp +++ b/src/tier1/interface.cpp @@ -194,6 +194,8 @@ uintp ThreadedLoadLibraryFunc( void *pParam ) HMODULE Sys_LoadLibrary( const char *pLibraryName, Sys_Flags flags ) { + #define DLL_EXT_STRING DLLExtTokenPaste2( _DLL_EXT ) + char str[ 1024 ]; // Note: DLL_EXT_STRING can be "_srv.so" or "_360.dll". So be careful // when using the V_*Extension* routines... From 22fa0bb23bab3dc007d469b1624b17104a946cc6 Mon Sep 17 00:00:00 2001 From: Masterkatze Date: Sat, 6 Jun 2026 17:57:27 +0300 Subject: [PATCH 2/2] More fine-grained defines --- src/CMakeLists.txt | 2 -- src/game/client/CMakeLists.txt | 4 ++++ src/game/server/CMakeLists.txt | 4 ++++ src/tier1/CMakeLists.txt | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 329c973079..b24fad617a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,8 +148,6 @@ add_compile_definitions( # SDK2013CE # Cut out since 2025-02-18 TF2 SDK Update NEO GLOWS_ENABLE - _DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX} - _EXTERNAL_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX} _GLIBCXX_USE_CXX11_ABI=0 FRAME_POINTER_OMISSION_DISABLED SOURCE1=1 diff --git a/src/game/client/CMakeLists.txt b/src/game/client/CMakeLists.txt index 19c2458a4c..bc970f3a15 100644 --- a/src/game/client/CMakeLists.txt +++ b/src/game/client/CMakeLists.txt @@ -679,6 +679,10 @@ target_sources_grouped( weapons_resource.cpp ) +set_source_files_properties(cdll_client_int.cpp PROPERTIES + COMPILE_OPTIONS "-D_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX};-D_EXTERNAL_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" +) + if(OS_LINUX) target_sources_grouped( TARGET client diff --git a/src/game/server/CMakeLists.txt b/src/game/server/CMakeLists.txt index fe219a20cc..48b93f0ca3 100644 --- a/src/game/server/CMakeLists.txt +++ b/src/game/server/CMakeLists.txt @@ -761,6 +761,10 @@ target_sources_grouped( world.h ) +set_source_files_properties(gameinterface.cpp PROPERTIES + COMPILE_OPTIONS "-D_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX};-D_EXTERNAL_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" +) + if(OS_LINUX) target_sources_grouped( TARGET server diff --git a/src/tier1/CMakeLists.txt b/src/tier1/CMakeLists.txt index 93b9935cef..e8f5c848c3 100644 --- a/src/tier1/CMakeLists.txt +++ b/src/tier1/CMakeLists.txt @@ -83,6 +83,10 @@ target_sources_grouped( snappy-stubs-internal.cpp ) +set_source_files_properties(interface.cpp PROPERTIES + COMPILE_OPTIONS "-D_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX};-D_EXTERNAL_DLL_EXT=${SRV_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}" +) + if(NOT SOURCESDK) target_sources_grouped( TARGET tier1