Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Build C::B against wx3.02 with gcc 5.2 under Windows
stahta01:
I am NOT going to use your patch; because the CBP changes is too complex for what I think you are trying to do.
I think the use of "-Wl,--export-all-symbols" is a bad idea; but, it does have tradeoffs that are worth trying.
So, I am going to make a patch that does what I think you wish to do; and you can look at it and test it.
The bad effects that I think go along with using "-Wl,--export-all-symbols" are:
1. It can increase code coupling by accident. It can result is code you wish to be private/protected being more exposed.
2. It increases the size of the DLL file.
3. It likely results in greater ABI changes than are needed.
The good effect
1. It can make it simpler to make windows DLL.
Tim S.
ollydbg:
--- Quote from: stahta01 on October 11, 2015, 06:09:15 pm ---I am NOT going to use your patch; because the CBP changes is too complex for what I think you are trying to do.
I think the use of "-Wl,--export-all-symbols" is a bad idea; but, it does have tradeoffs that are worth trying.
So, I am going to make a patch that does what I think you wish to do; and you can look at it and test it.
The bad effects that I think go along with using "-Wl,--export-all-symbols" are:
1. It can increase code coupling by accident. It can result is code you wish to be private/protected being more exposed.
2. It increases the size of the DLL file.
3. It likely results in greater ABI changes than are needed.
The good effect
1. It can make it simpler to make windows DLL.
Tim S.
--- End quote ---
Yes, I agree, if all the symbols which need to be exported are marked as "__declspec(dllexport)", we can safely remove the "-Wl,--export-all-symbols" linker option.
BTW: with my patch, I see the built exe and plugin dlls are slightly a little bigger, because I see more functions were in their exported symbol.
I'm looking forward to see your patch. :)
ollydbg:
I just did some test, if I remove the "-Wl,--export-all-symbols" option in the SDK target, after build the codeblocks.dll, I try to build the src target, but I get a lot of link errors, it looks like there are many classes which need to add "__declspec(dllexport)" decoration.
oBFusCATed:
What are the link errors and why does it work with 2.8?
ollydbg:
--- Quote from: oBFusCATed on October 12, 2015, 08:57:55 pm ---What are the link errors and why does it work with 2.8?
--- End quote ---
1, undefined reference to some symbol name.
2, codeblocks.cbp ( for wx2.8 ) has the same "-Wl,--export-all-symbols" in its sdk target.
EDIT: my changes:
--- Code: --- src/CodeBlocks_wx30.cbp | 1 -
src/include/cbexception.h | 2 +-
src/include/cbstyledtextctrl.h | 2 +-
src/include/editorcolourset.h | 2 +-
src/include/filemanager.h | 4 ++--
src/include/manager.h | 2 +-
src/include/scrollingdialog.h | 2 +-
src/include/xtra_res.h | 4 ++--
src/sdk/scrollingdialog.cpp | 3 ++-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/CodeBlocks_wx30.cbp b/src/CodeBlocks_wx30.cbp
index ac09ab1..5a304dd 100644
--- a/src/CodeBlocks_wx30.cbp
+++ b/src/CodeBlocks_wx30.cbp
@@ -136,7 +136,6 @@
</Compiler>
<Linker>
<Add option="-Wl,--enable-auto-image-base" />
- <Add option="-Wl,--export-all-symbols" />
<Add option="-Wl,--add-stdcall-alias" />
<Add option="-Wl,--enable-auto-import" />
<Add option="-Wl,--no-undefined" />
diff --git a/src/include/cbexception.h b/src/include/cbexception.h
index 2044dd9..bfa91bc 100644
--- a/src/include/cbexception.h
+++ b/src/include/cbexception.h
@@ -20,7 +20,7 @@ cbThrow() and cbAssert().
*/
/** @brief The base Code::Blocks exception object. */
-class cbException
+class DLLIMPORT cbException
{
public:
cbException(const wxString& msg, const wxString& file, int line);
diff --git a/src/include/cbstyledtextctrl.h b/src/include/cbstyledtextctrl.h
index 55835a3..77c3d78 100644
--- a/src/include/cbstyledtextctrl.h
+++ b/src/include/cbstyledtextctrl.h
@@ -17,7 +17,7 @@ class wxFocusEvent;
class wxMouseEvent;
class wxPoint;
-class cbStyledTextCtrl : public wxScintilla
+class DLLIMPORT cbStyledTextCtrl : public wxScintilla
{
public:
cbStyledTextCtrl(wxWindow* pParent, int id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
diff --git a/src/include/editorcolourset.h b/src/include/editorcolourset.h
index a6573bd..e79ddac 100644
--- a/src/include/editorcolourset.h
+++ b/src/include/editorcolourset.h
@@ -73,7 +73,7 @@ struct OptionSet
};
WX_DECLARE_STRING_HASH_MAP(OptionSet, OptionSetsMap);
-class EditorColourSet
+class DLLIMPORT EditorColourSet
{
public:
EditorColourSet(const wxString& setName = COLORSET_DEFAULT);
diff --git a/src/include/filemanager.h b/src/include/filemanager.h
index 343c087..6d80f04 100644
--- a/src/include/filemanager.h
+++ b/src/include/filemanager.h
@@ -28,7 +28,7 @@ namespace TinyXML{ bool SaveDocument(const wxString&, TiXmlDocument*); }
// ***** class: LoaderBase *****
-class LoaderBase : public AbstractJob
+class DLLIMPORT LoaderBase : public AbstractJob
{
wxSemaphore sem;
bool wait;
@@ -109,7 +109,7 @@ public:
};
// ***** class: FileManager *****
-class FileManager : public Mgr<FileManager>
+class DLLIMPORT FileManager : public Mgr<FileManager>
{
BackgroundThread fileLoaderThread;
BackgroundThread uncLoaderThread;
diff --git a/src/include/manager.h b/src/include/manager.h
index 7dfe827..cd0cb30 100644
--- a/src/include/manager.h
+++ b/src/include/manager.h
@@ -179,7 +179,7 @@ private:
cbSearchResultsLog *m_SearchResultLog;
};
-template <class MgrT> class Mgr
+template <class MgrT> class DLLIMPORT Mgr
{
static MgrT *instance;
static bool isShutdown;
diff --git a/src/include/scrollingdialog.h b/src/include/scrollingdialog.h
index 33725fe..072d578 100644
--- a/src/include/scrollingdialog.h
+++ b/src/include/scrollingdialog.h
@@ -159,7 +159,7 @@ protected:
* A class that makes its content scroll if necessary
*/
-class wxScrollingDialog: public wxDialog
+class DLLIMPORT wxScrollingDialog: public wxDialog
#if !wxCHECK_VERSION(2,9,0)
, public wxDialogHelper
#endif
diff --git a/src/include/xtra_res.h b/src/include/xtra_res.h
index b8848d5..35494e3 100644
--- a/src/include/xtra_res.h
+++ b/src/include/xtra_res.h
@@ -13,7 +13,7 @@
class wxXmlResourceHandler;
-class wxToolBarAddOnXmlHandler : public wxXmlResourceHandler
+class DLLIMPORT wxToolBarAddOnXmlHandler : public wxXmlResourceHandler
{
public:
wxToolBarAddOnXmlHandler();
@@ -30,7 +30,7 @@ class wxToolBarAddOnXmlHandler : public wxXmlResourceHandler
wxSize size = wxDefaultSize);
};
-class wxScrollingDialogXmlHandler : public wxDialogXmlHandler
+class DLLIMPORT wxScrollingDialogXmlHandler : public wxDialogXmlHandler
{
DECLARE_DYNAMIC_CLASS(wxScrollingDialogXmlHandler)
diff --git a/src/sdk/scrollingdialog.cpp b/src/sdk/scrollingdialog.cpp
index e847775..cef22e8 100644
--- a/src/sdk/scrollingdialog.cpp
+++ b/src/sdk/scrollingdialog.cpp
@@ -8,8 +8,9 @@
// Copyright: (c) Julian Smart
// Licence:
/////////////////////////////////////////////////////////////////////////////
+#include "sdk_precomp.h"
+
-#include "wx/wx.h"
#include "wx/module.h"
#include "wx/display.h"
#include "wx/bookctrl.h"
--- End code ---
But I still see the undefined reference to wxScintilla when building src target
--- Code: ---[100.0%] g++.exe -Lbase\tinyxml -LD:\wx3\lib\gcc_dll -Ldevel30 -Lexchndl\win32\lib -o devel30\codeblocks.exe .objs30\src\app.o .objs30\src\appglobals.o .objs30\src\associations.o .objs30\src\backtracedlg.o .objs30\src\breakpointsdlg.o .objs30\src\compilersettingsdlg.o .objs30\src\cpuregistersdlg.o .objs30\src\crashhandler.o .objs30\src\debugger_interface_creator.o .objs30\src\debuggermenu.o .objs30\src\debuggersettingscommonpanel.o .objs30\src\debuggersettingsdlg.o .objs30\src\debuggersettingspanel.o .objs30\src\disassemblydlg.o .objs30\src\dlgabout.o .objs30\src\dlgaboutplugin.o .objs30\src\editkeywordsdlg.o .objs30\src\editorconfigurationdlg.o .objs30\src\environmentsettingsdlg.o .objs30\src\examinememorydlg.o .objs30\src\find_replace.o .objs30\src\infopane.o .objs30\src\main.o .objs30\src\notebookstyles.o .objs30\src\printdlg.o .objs30\src\projectdepsdlg.o .objs30\src\projectmanagerui.o .objs30\src\projectoptionsdlg.o .objs30\src\recentitemslist.o .objs30\src\scriptconsole.o .objs30\src\scriptingsettingsdlg.o .objs30\src\splashscreen.o .objs30\src\startherepage.o .objs30\src\switcherdlg.o .objs30\src\threadsdlg.o .objs30\src\virtualbuildtargetsdlg.o .objs30\src\watchesdlg.o .objs30\src\resources\resources.res -Wl,--enable-auto-import -Wl,--no-undefined -lcodeblocks -lexchndl -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxmsw30ud -mwindows
.objs30\src\crashhandler.o: In function `Z27CrashHandlerSaveEditorFilesR8wxString':
F:\cb_sf_git\trunk\src/src/crashhandler.cpp:62: undefined reference to `wxScintilla::GetText() const'
.objs30\src\debugger_interface_creator.o: In function `ZN21DebugInterfaceFactory16ShowValueTooltipERKNSt3tr110shared_ptrI7cbWatchEERK6wxRect':
F:\cb_sf_git\trunk\src/src/debugger_interface_creator.cpp:216: undefined reference to `wxScintilla::CallTipActive()'
.objs30\src\debuggermenu.o: In function `ZN19DebuggerMenuHandler13OnRunToCursorER14wxCommandEvent':
F:\cb_sf_git\trunk\src/src/debuggermenu.cpp:631: undefined reference to `wxScintilla::GetCurrentLine()'
F:\cb_sf_git\trunk\src/src/debuggermenu.cpp:631: undefined reference to `wxScintilla::GetLine(int) const'
F:\cb_sf_git\trunk\src/src/debuggermenu.cpp:643: undefined reference to `wxScintilla::GetCurrentLine()'
.objs30\src\debuggermenu.o: In function `ZN19DebuggerMenuHandler18OnSetNextStatementER14wxCommandEvent':
F:\cb_sf_git\trunk\src/src/debuggermenu.cpp:655: undefined reference to `wxScintilla::GetCurrentLine()'
.objs30\src\disassemblydlg.o: In function `ZN14DisassemblyDlgC2EP8wxWindow':
F:\cb_sf_git\trunk\src/src/disassemblydlg.cpp:55: undefined reference to `wxSCINameStr'
F:\cb_sf_git\trunk\src/src/disassemblydlg.cpp:55: undefined reference to `wxScintilla::wxScintilla(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)'
...
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version