File define_MULE_EVT_NOTIFY.patch of Package aMule

commit 6637b9d5ddc90726374b85290982a2bbb55a841d
Author: got3nks <got3nks@users.noreply.github.com>
Date:   Thu Jul 9 12:14:07 2026 +0200

    fix(amulecmd): define MULE_EVT_NOTIFY so LTO builds link (#368)
    
    amulecmd references MULE_EVT_NOTIFY through the header-inline CMuleGUIEvent
    (pulled in via TextClient.cpp) but links no translation unit that defines it:
    GuiEvents.cpp (muleappcore) and WebInterface.cpp (webserver) are not linked
    into amulecmd. Non-LTO builds dead-strip the unused inline CMuleGUIEvent
    ctor/Clone() copies before the symbol is demanded, so the gap stayed latent;
    under LTO the vtable is retained and the reference reaches the final link
    undefined, breaking the amulecmd link.
    
    Regression from c30cdc42b, which changed MULE_EVT_NOTIFY from a plain
    const wxEventType (an int, foldable/strippable) into a const
    wxEventTypeTag<wxEvent> object. Define it in amulecmd's console TU, matching
    the per-binary event-definition pattern already used for MULE_EVT_LOGLINE in
    LoggerConsole.cpp.
    
    Refs #367

diff --git a/src/TextClient.cpp b/src/TextClient.cpp
index 20281049e..e27618dd0 100644
--- a/src/TextClient.cpp
+++ b/src/TextClient.cpp
@@ -1382,6 +1382,16 @@ int CamulecmdApp::OnRun()
 
 // Stub functions needed by the linker in ASIO builds
 #include "GuiEvents.h"
+
+// MULE_EVT_NOTIFY is declared in GuiEvents.h and referenced by the header-inline
+// CMuleGUIEvent (its ctor and Clone()) that this console binary pulls in, but amulecmd
+// links no TU that defines it: GuiEvents.cpp lives in muleappcore and WebInterface.cpp
+// in the webserver, neither of which amulecmd links. Non-LTO builds dead-strip the
+// unused inline copies before the symbol is demanded; LTO keeps the CMuleGUIEvent vtable
+// and the reference survives to the final link, so the definition must live here. Same
+// per-binary event-definition pattern as MULE_EVT_LOGLINE in LoggerConsole.cpp.
+wxDEFINE_EVENT(MULE_EVT_NOTIFY, wxEvent);
+
 namespace MuleNotify
 {
 	void HandleNotification(const class CMuleNotiferBase&) {}