Export MultiplayerExt symbols accessed from isle executable (#1)

* Export MultiplayerExt symbols accessed from isle executable

When lego1 is built as a shared library (DLL), symbols used by the isle
executable through the Extension<T>::Call() template need to be exported.
Add LEGO1_EXPORT to MultiplayerExt::enabled and MultiplayerExt::CheckRejected()
which are referenced from isleapp.cpp via the template instantiation.

https://claude.ai/code/session_01HHMmowothg25fephi6iidq

* Use inline const instead of constexpr for extension function pointers

constexpr cannot be used with dllimport function addresses since they
are resolved at load time through the IAT, not at compile time. Change
to inline const which preserves the single-definition semantics (via
inline) while allowing runtime initialization of the function pointers.

https://claude.ai/code/session_01HHMmowothg25fephi6iidq

* Fix multiplayer extension link errors across DLL boundary

When lego1 is a shared library, Extension<T>::Call() instantiated from
isle.exe references MultiplayerExt::enabled and CheckRejected() which
are not exported. Instead of exporting internal symbols (which also
breaks constexpr with dllimport), add an exported IsMultiplayerRejected()
wrapper that keeps the Extension<T>::Call() instantiation inside lego1.

https://claude.ai/code/session_01HHMmowothg25fephi6iidq

* Guard IsMultiplayerRejected with EXTENSIONS ifdef

extensions.cpp is only compiled when ISLE_EXTENSIONS is ON, so the
wrapper function and its call site need #ifdef EXTENSIONS guards for
targets like x86 MSVC where extensions are disabled.

https://claude.ai/code/session_01HHMmowothg25fephi6iidq

* Move IsMultiplayerRejected definition to multiplayer.cpp

The function is declared in multiplayer.h and belongs with the rest of
the multiplayer extension code, not in the general extensions.cpp file.

https://claude.ai/code/session_01HHMmowothg25fephi6iidq

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
foxtacles 2026-03-01 18:21:15 -08:00 committed by GitHub
parent 5b56db3c33
commit 29955df947
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -37,7 +37,6 @@
#include "viewmanager/viewmanager.h" #include "viewmanager/viewmanager.h"
#include <array> #include <array>
#include <extensions/extensions.h>
#include <extensions/multiplayer.h> #include <extensions/multiplayer.h>
#include <miniwin/miniwindevice.h> #include <miniwin/miniwindevice.h>
#include <type_traits> #include <type_traits>
@ -1297,10 +1296,12 @@ inline bool IsleApp::Tick()
return true; return true;
} }
if (Extension<MultiplayerExt>::Call(CheckRejected).value_or(FALSE)) { #ifdef EXTENSIONS
if (Extensions::IsMultiplayerRejected()) {
g_closed = TRUE; g_closed = TRUE;
return true; return true;
} }
#endif
if (!TickleManager()) { if (!TickleManager()) {
return true; return true;

View File

@ -45,6 +45,8 @@ class MultiplayerExt {
}; };
#ifdef EXTENSIONS #ifdef EXTENSIONS
LEGO1_EXPORT bool IsMultiplayerRejected();
constexpr auto HandleWorldEnable = &MultiplayerExt::HandleWorldEnable; constexpr auto HandleWorldEnable = &MultiplayerExt::HandleWorldEnable;
constexpr auto HandleEntityNotify = &MultiplayerExt::HandleEntityNotify; constexpr auto HandleEntityNotify = &MultiplayerExt::HandleEntityNotify;
constexpr auto CheckRejected = &MultiplayerExt::CheckRejected; constexpr auto CheckRejected = &MultiplayerExt::CheckRejected;

View File

@ -1,5 +1,6 @@
#include "extensions/multiplayer.h" #include "extensions/multiplayer.h"
#include "extensions/extensions.h"
#include "extensions/multiplayer/networkmanager.h" #include "extensions/multiplayer/networkmanager.h"
#include "extensions/multiplayer/networktransport.h" #include "extensions/multiplayer/networktransport.h"
#include "extensions/multiplayer/protocol.h" #include "extensions/multiplayer/protocol.h"
@ -118,3 +119,8 @@ Multiplayer::NetworkManager* MultiplayerExt::GetNetworkManager()
{ {
return s_networkManager; return s_networkManager;
} }
bool Extensions::IsMultiplayerRejected()
{
return Extension<MultiplayerExt>::Call(CheckRejected).value_or(FALSE);
}