From f112ae6187af66183824d42f15009fa958931eaf Mon Sep 17 00:00:00 2001 From: Mustafa Topsakal <44037649+mustafatopsakal@users.noreply.github.com> Date: Mon, 31 Aug 2026 17:29:21 +0300 Subject: [PATCH] ModuleMixin: export the internal helpers from the library Code outside the INET library that derives from an INET module class fails to link on Windows: ld.lld: error: undefined symbol: inet::internal::refreshDisplayString(omnetpp::cModule*, inet::StringFormat::IResolver const*) ld.lld: error: undefined symbol: inet::internal::doResolveExpression(omnetpp::cModule*, char const*) Both helpers are called from the ModuleMixin class template, so the calls are instantiated in the consumer's translation unit, but the symbols are not exported from the shared library. Inside INET the calls resolve locally, which is why the failure appears only outside it. Marking only the declarations is not sufficient, because ModuleMixin.cc does not include ModuleMixin.h; the consumer error then becomes an unresolved __declspec(dllimport) symbol and the link still fails. Adding the include would be the alternative, but marking both sides keeps the export explicit at the point of declaration. INET_API is already reachable in ModuleMixin.cc through StringFormat.h, so no new include is needed. Fixes #1137 --- src/inet/common/ModuleMixin.cc | 4 ++-- src/inet/common/ModuleMixin.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inet/common/ModuleMixin.cc b/src/inet/common/ModuleMixin.cc index 104cfb83f98..ad1321c1042 100644 --- a/src/inet/common/ModuleMixin.cc +++ b/src/inet/common/ModuleMixin.cc @@ -36,7 +36,7 @@ class cCollectObjectsVisitor : public cVisitor namespace internal { -void refreshDisplayString(cModule *thisModule, const StringFormat::IResolver *thisModuleAsResolver) +INET_API void refreshDisplayString(cModule *thisModule, const StringFormat::IResolver *thisModuleAsResolver) { if (thisModule->hasPar("displayStringTextFormat")) { try { @@ -53,7 +53,7 @@ void refreshDisplayString(cModule *thisModule, const StringFormat::IResolver *th } } -std::string doResolveExpression(cModule *thisModule, const char *expression) +INET_API std::string doResolveExpression(cModule *thisModule, const char *expression) { const char *lastDot = strrchr(expression, '.'); diff --git a/src/inet/common/ModuleMixin.h b/src/inet/common/ModuleMixin.h index bf0e35a0c15..aebe4bd1b6e 100644 --- a/src/inet/common/ModuleMixin.h +++ b/src/inet/common/ModuleMixin.h @@ -17,8 +17,8 @@ namespace inet { namespace internal { -void refreshDisplayString(cModule *thisModule, const StringFormat::IResolver *thisModuleAsResolver); -std::string doResolveExpression(cModule *targetModule, const char *expression); +INET_API void refreshDisplayString(cModule *thisModule, const StringFormat::IResolver *thisModuleAsResolver); +INET_API std::string doResolveExpression(cModule *targetModule, const char *expression); } /**