RE: [wx-dev] Statically linked programs are linking in unneeded m odules.

2 views
Skip to first unread message

Dave Webster

unread,
Oct 9, 2002, 2:41:02 PM10/9/02
to wx-...@lists.wxwindows.org
Spaghetti dependencies. It has just evolved over time that the library has
become a labarynth of entwined and entangled dependencies to the point where
even the most trivial GUI app has to pull in a majority of the library in
order to link properly. It's not a problem that can really be solved
adequately without a complete design overhaul of the entire system and then
a rigirous management layer to prevent contributors from creating unneeded
dependencies. Just ask the maintainers of the image handlers how difficult
it is to prevent people from adding dependencies that would keep them from
being used in wxBase.

-----Original Message-----
From: Louis B [mailto:louisj...@hotmail.com]
Sent: Tuesday, October 08, 2002 6:08 PM
To: wx-...@lists.wxwindows.org
Subject: [wx-dev] Statically linked programs are linking in unneeded
modules.


I have been trying to solve the problem as to why the statically link
programs are so large. This is especially a problem for embedded
applications where space is at a premium but also it does not look too good
when the standard minimal sample ends up much larger than is necessary.

It is fairly obvious that the minimal program is pulling out of the library
modules that it is not actually using. This is confirmed by looking at the
".map" output of the linker. For example the map file for minimal compiled
using MSVC++ for wxUniversal shows that program has pulled out of the
library the code for wxSlider. Which clearly is not require.

The most EFFECTIVE way I have found as to why a module is included, when it
should not be, is to remove the module from the library and then look at the

error messages.

When I removed wxSlider from the wxUniversal library I get the error message

that I have included at the end of this e-mail.

This shows that the wxWin32Theme::GetInputHandler and
wxGTKTheme::GetInputHandler functions are the culprits as it forces a lot of

unnecessary classes to be pulled from the library.

On digging around a bit further getInputHandler is only called from
wxInputConsumer::CreateInputHandler. And this function is only called in
turn when each control is created. For example wxSlider::Create includes the

line:
CreateInputHandler(wxINP_HANDLER_SLIDER);

I am sure that there is an alternative way of coding this that will not
cause lots of unused classes to be pulled out of the library. Although I
have found the problem for wxSlider I am not skilled enough at C++ or
wxWindows to recommend a solution.

I realise that that it is quite a lot of work to go through the libraries
and untangle all the interdependencies . But there might be some cases which

might be quiet easy to fix as looks like the case for wxSlider and minimal.

I hope this helps.

Louis B.

------------Configuration: minimal - Win32 Release--------------
Linking...
wxuniv.lib(win32.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleFocus(class
wxInputConsumer *,class wxFocusEvent const &)"
(?HandleFocus@wxStdSliderButtonInputHandler@@UAE_NPAVw
xInputConsumer@@ABVwxFocusEvent@@@Z)
wxuniv.lib(gtk.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleFocus(class
wxInputConsumer *,class wxFocusEvent const &)"
(?HandleFocus@wxStdSliderButtonInputHandler@@UAE_NPAVwxI
nputConsumer@@ABVwxFocusEvent@@@Z)
wxuniv.lib(win32.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleMouseMove(class

wxInputConsumer *,class wxMouseEvent const &)"
(?HandleMouseMove@wxStdSliderButtonInputHandler@@U
AE_NPAVwxInputConsumer@@ABVwxMouseEvent@@@Z)
wxuniv.lib(gtk.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleMouseMove(class

wxInputConsumer *,class wxMouseEvent const &)"
(?HandleMouseMove@wxStdSliderButtonInputHandler@@UAE
_NPAVwxInputConsumer@@ABVwxMouseEvent@@@Z)
wxuniv.lib(win32.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleMouse(class
wxInputConsumer *,class wxMouseEvent const &)"
(?HandleMouse@wxStdSliderButtonInputHandler@@UAE_NPAVw
xInputConsumer@@ABVwxMouseEvent@@@Z)
wxuniv.lib(gtk.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleMouse(class
wxInputConsumer *,class wxMouseEvent const &)"
(?HandleMouse@wxStdSliderButtonInputHandler@@UAE_NPAVwxI
nputConsumer@@ABVwxMouseEvent@@@Z)
wxuniv.lib(win32.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleKey(class
wxInputConsumer *,class wxKeyEvent const &,bool)"
(?HandleKey@wxStdSliderButtonInputHandler@@UAE_NPAVwx
InputConsumer@@ABVwxKeyEvent@@_N@Z)
wxuniv.lib(gtk.obj) : error LNK2001: unresolved external symbol "public:
virtual bool __thiscall wxStdSliderButtonInputHandler::HandleKey(class
wxInputConsumer *,class wxKeyEvent const &,bool)"
(?HandleKey@wxStdSliderButtonInputHandler@@UAE_NPAVwxIn
putConsumer@@ABVwxKeyEvent@@_N@Z)
UnivRelease/minimalUniv.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

minimalUniv.exe - 9 error(s), 0 warning(s)
------------------

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


_______________________________________________
wx-dev mailing list
wx-...@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wx-dev

Reply all
Reply to author
Forward
0 new messages