Another possible solution is we build wxscintilla as a static lib and link other *.so against it.
Agreed. I think that's the best way.
But it seems have some issue when build wxScintilla as a static lib.
Error log here:
||=== Code::Blocks, sdk ===|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|760|undefined reference to `_imp___ZN11wxScintilla7SetZoomEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|765|undefined reference to `_imp___ZN11wxScintilla13SetMarginMaskEii'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|766|undefined reference to `_imp___ZN11wxScintilla13SetMarginMaskEii'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|767|undefined reference to `_imp___ZN11wxScintilla13SetMarginMaskEii'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|768|undefined reference to `_imp___ZN11wxScintilla13SetMarginMaskEii'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|828|undefined reference to `_imp___ZNK11wxScintilla9GetModifyEv'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|838|undefined reference to `_imp___ZN11wxScintilla12SetSavePointEv'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|844|undefined reference to `_imp___ZNK11wxScintilla11GetReadOnlyEv'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|875|undefined reference to `_imp___ZN11wxScintilla7GotoPosEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|876|undefined reference to `_imp___ZN11wxScintilla12ScrollToLineEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|877|undefined reference to `_imp___ZN11wxScintilla14ScrollToColumnEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|910|undefined reference to `_imp___ZNK11wxScintilla13GetCurrentPosEv'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|911|undefined reference to `_imp___ZNK11wxScintilla19GetFirstVisibleLineEv'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|918|undefined reference to `_imp___ZN11wxScintilla12MarkerDefineEiiRK8wxColourS2_'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|919|undefined reference to `_imp___ZN11wxScintilla19MarkerSetForegroundEiRK8wxColour'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|920|undefined reference to `_imp___ZN11wxScintilla19MarkerSetBackgroundEiRK8wxColour'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|924|undefined reference to `_imp___ZN11wxScintilla12MarkerDefineEiiRK8wxColourS2_'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|925|undefined reference to `_imp___ZN11wxScintilla19MarkerSetForegroundEiRK8wxColour'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|926|undefined reference to `_imp___ZN11wxScintilla19MarkerSetBackgroundEiRK8wxColour'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|932|undefined reference to `_imp___ZN11wxScintilla12SetFoldFlagsEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|934|undefined reference to `_imp___ZN11wxScintilla12SetFoldFlagsEi'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|947|undefined reference to `_imp___ZN11wxScintilla8UsePopUpEb'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|955|undefined reference to `_imp__wxEVT_SCI_MARGINCLICK'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|958|undefined reference to `_imp__wxEVT_SCI_UPDATEUI'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|961|undefined reference to `_imp__wxEVT_SCI_CHANGE'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|964|undefined reference to `_imp__wxEVT_SCI_CHARADDED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|967|undefined reference to `_imp__wxEVT_SCI_DWELLSTART'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|970|undefined reference to `_imp__wxEVT_SCI_DWELLEND'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|973|undefined reference to `_imp__wxEVT_SCI_USERLISTSELECTION'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|976|undefined reference to `_imp__wxEVT_SCI_MODIFIED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_STYLENEEDED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_SAVEPOINTREACHED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_SAVEPOINTLEFT'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_ROMODIFYATTEMPT'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_KEY'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_DOUBLECLICK'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_MACRORECORD'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_NEEDSHOWN'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_PAINTED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_URIDROPPED'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_START_DRAG'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_DRAG_OVER'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_DO_DROP'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_ZOOM'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_HOTSPOT_CLICK'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_HOTSPOT_DCLICK'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_CALLTIP_CLICK'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_AUTOCOMP_SELECTION'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_TAB'|
.objs\sdk\cbeditor.o:D:\DengYC\CodeBlocks-C\src\sdk\cbeditor.cpp|1019|undefined reference to `_imp__wxEVT_SCI_ESC'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings (0 minutes, 19 seconds) ===|
Any comments are welcome!
This is my second trying, the error is as follows.
MORE-WARNING-...
----
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|4990|warning: 'bool wxScintillaEvent::GetControl() const' redeclared without dllimport attribute: previous dllimport ignored|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|4991|warning: 'bool wxScintillaEvent::GetAlt() const' redeclared without dllimport attribute: previous dllimport ignored|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|4994|warning: 'wxScintillaEvent::wxScintillaEvent(const wxScintillaEvent&)' redeclared without dllimport attribute after being referenced with dll linkage|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|122|error: definition of static data member 'wxScintilla::sm_eventTable' of dllimport'd class|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|122|error: definition of static data member 'wxScintilla::sm_eventHashTable' of dllimport'd class|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|150|error: definition of static data member 'wxScintilla::ms_classInfo' of dllimport'd class|
D:\DengYC\CodeBlocks-C\src\sdk\wxscintilla\src\wxscintilla.cpp|151|error: definition of static data member 'wxScintillaEvent::ms_classInfo' of dllimport'd class|
||=== Build finished: 4 errors, 685 warnings (0 minutes, 22 seconds) ===|
@Jens,Loaden: please keep in mind not to touch the wxscintilla component too much - I've have quite a lot changes pending from my side, including an update of scintilla. So please don't cause too much conflicts (project files are OK of course).
Copy that.
Have another question, why we need hack this code from:
SCNotification scn = {0};
to:
/* C::B begin */
SCNotification scn; memset((void*)&scn, 0, sizeof(scn));
/* C::B end */
:?
...This is a structure and if you only set the first value to zero, the other values may still be invalid on initialisation (platform / compiler dependent).
Hm, C++ standard says that the unspecified members are initialized with zero (If I remember correctly).
I can sure it, so, I think it maybe not needed to hack.
But it should be
SCNotification scn = {{0}};
...This is a structure and if you only set the first value to zero, the other values may still be invalid on initialisation (platform / compiler dependent).
Hm, C++ standard says that the unspecified members are initialized with zero (If I remember correctly).
I can sure it, so, I think it maybe not needed to hack.
But it should be
SCNotification scn = {{0}};
No, you can use just {0}.
See:
#include <iostream>
using namespace std;
struct A
{
int i;
float j;
char c;
int* p;
};
int main()
{
A a = {0};
cout << a.i << "," << a.j << "," << a.c << "," << a.p << endl;
return 0;
}
It's not correct in our case, because the first element of the struct is a struct, that needs to be initialised with {0} itself.
All other elements are set to zero (or their default values ?) automagically.
#include <iostream>
using namespace std;
struct B
{
int j;
};
struct A
{
struct B b;
int i;
float j;
char c;
int* p;
};
int main()
{
A a = {0};
cout << a.b.j << "," << a.i << "," << a.j << "," << a.c << "," << a.p << endl;
return 0;
}
leads to warning:
main.cpp:21:13: warning: missing braces around initializer for ‘B’
even if it works.
Can you test my new patch, works for me on XP SP3, wx2.8.10 and TDM gcc 4.5.0 (just for the core project-file at the moment).
Well done! testing passed.
And have a issue, I think we need change the lib name from "libwxscintilla.a" to "libcbscintilla.a" or "libwxscintilla_cb.a".
Because in wx2.9.x, the wxscintilla library named "libwxscintilla.a" too. :)
Any comments about the library name?
BTW, I am testting in XPSP3, if build wxScintilla as static library, the core (not include contrib) result is : 16.5MB.
And, If build wxScintilla as shared library, the core reulst is 16.5 MB too.
In fact, only codeblocks.dll size have changed.
DLL Name static build shared build
codeblocks.dll 4.76MB 3.62MB
If a struct is inside struct and we want to initialize it to zero we need to enclose it with { } Thus gcc was throwing warning on the original code.
So correct form should be -
struct foo f = { {0}, 0};
M$VC not being standard compliant can ignore such code. :)