commit 373f8fecbdbe3610f918ceda8698a202d03b40b7
Author: Vadim Zeitlin
Date: Fri Aug 15 23:37:42 2014 +0200
Ensure that the modules setting up wx-specific callbacks are linked in.
While GNU ld unconditionally takes all the object files from a static library
when creating an executable, Microsoft linker completely ignores the object
files not containing any symbols referenced from elsewhere and so discarded
the object files compiled from file_command_wx.cpp, progress_meter_wx.cpp and
system_command_wx.cpp and hence didn't execute the code initializing the
corresponding subsystem.
Fix this by explicitly referencing these files from the main file of the
wxWidgets application and test suite to ensure that they are always linked in.
diff --git a/file_command_wx.cpp b/file_command_wx.cpp
index d8aebdf..ac26223 100644
--- a/file_command_wx.cpp
+++ b/file_command_wx.cpp
@@ -29,6 +29,7 @@
#include "file_command.hpp"
#include "alert.hpp"
+#include "force_linking.hpp"
#include
#include
@@ -37,6 +38,8 @@
#include
#include // wxExecute()
+LMI_FORCE_LINKING_IN_SITU(file_command_wx);
+
// Implementing this function in a GUI module means the wx facility
// can be used. Currently, no other interface needs to implement it.
diff --git a/main_wx.cpp b/main_wx.cpp
index d2f8fae..b02c095 100644
--- a/main_wx.cpp
+++ b/main_wx.cpp
@@ -37,6 +37,7 @@
#endif // __BORLANDC__
#include "fenv_lmi.hpp"
+#include "force_linking.hpp"
#include "handle_exceptions.hpp"
#include "main_common.hpp" // initialize_application()
#include "msw_workarounds.hpp"
@@ -47,6 +48,10 @@
#include
+LMI_FORCE_LINKING_EX_SITU(file_command_wx);
+LMI_FORCE_LINKING_EX_SITU(progress_meter_wx);
+LMI_FORCE_LINKING_EX_SITU(system_command_wx);
+
IMPLEMENT_APP_NO_MAIN(Skeleton)
IMPLEMENT_WX_THEME_SUPPORT
diff --git a/main_wx_test.cpp b/main_wx_test.cpp
index 8ea4cfb..e0a5de5 100644
--- a/main_wx_test.cpp
+++ b/main_wx_test.cpp
@@ -27,6 +27,7 @@
#endif
#include "assert_lmi.hpp"
+#include "force_linking.hpp"
#include "main_common.hpp" // initialize_application()
#include "msw_workarounds.hpp"
#include "path_utility.hpp" // initialize_filesystem()
@@ -38,6 +39,10 @@
#include
#include
+LMI_FORCE_LINKING_EX_SITU(file_command_wx);
+LMI_FORCE_LINKING_EX_SITU(progress_meter_wx);
+LMI_FORCE_LINKING_EX_SITU(system_command_wx);
+
class SkeletonTest;
DECLARE_APP(SkeletonTest)
diff --git a/progress_meter_wx.cpp b/progress_meter_wx.cpp
index 4747101..20d8590 100644
--- a/progress_meter_wx.cpp
+++ b/progress_meter_wx.cpp
@@ -28,6 +28,7 @@
#include "progress_meter.hpp"
+#include "force_linking.hpp"
#include "wx_utility.hpp" // TopWindow()
#include
@@ -36,6 +37,8 @@
#include // std::fixed, std::ios_base::precision()
#include
+LMI_FORCE_LINKING_IN_SITU(progress_meter_wx);
+
namespace
{
// Implicitly-declared special member functions do the right thing.
diff --git a/system_command_wx.cpp b/system_command_wx.cpp
index 885f75e..fc8bc86 100644
--- a/system_command_wx.cpp
+++ b/system_command_wx.cpp
@@ -29,6 +29,7 @@
#include "system_command.hpp"
#include "alert.hpp"
+#include "force_linking.hpp"
#include "null_stream.hpp"
#include "timer.hpp"
@@ -39,6 +40,8 @@
#include // std::size_t
#include
+LMI_FORCE_LINKING_IN_SITU(system_command_wx);
+
namespace
{
void assemble_console_lines