Page 1 of 1

dynarray

Posted: Fri Jul 13, 2018 5:30 pm
by raananb
An application which has been compiled with no errors since a number of years on MSW and OSX, now raises a problem with the code below.

Under Windows 10, with today's trunk and Visual Studio 2017 WX_DECLARE_OBJARRAY is undelined with green wigglies, reporting that the function declaration is not found but finally getting the application up and running.

Under OSX (10.13.5) GCC 8 raises an error in the second line, pointing at the beginning of the line and claiming a ')'. OSX then raises an error on the fourth line "out-of-line definition of 'Clone' does not match any declaration in wxOnjectArrayTraitsForArrayOfCFTextCtrlPointers'

#include <wx/dynarray.h>
WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(ArrayOfCFTextCtrlPointers);

What is the problem here? (suggestions to use wxVector aside).

Re: dynarray

Posted: Fri Jul 13, 2018 6:19 pm
by doublemax
What exactly did change since the last time you compiled this? The compiler or the wxWidgets version, or both or anything else?

Code: Select all

WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);
This is a little strange, because WX_DECLARE_OBJARRAY assumes pointers anyway. So most likely it should be:

Code: Select all

WX_DECLARE_OBJARRAY(wxTextCtrl, ArrayOfCFTextCtrlPointers);
But then it shouldn't have worked before.

Re: dynarray

Posted: Fri Jul 13, 2018 7:22 pm
by PB
There have been several changes to the obsolete containers code, see
https://github.com/wxWidgets/wxWidgets/ ... pe=Commits

I guess these should not break anything in the existing code (assuming the code was correct)...

Re: dynarray

Posted: Fri Jul 13, 2018 9:07 pm
by raananb
@doublemax
Both changed, apparently - the compiler with 10.13.5 and the code with the trunk.
I'll try with 3.1.1, and then look into wxVector...

@PB
I dont know if the code was correct, but it worked...

Re: dynarray

Posted: Sat Jul 14, 2018 7:47 am
by raananb
No problems with 3.1.1

The trunk is no longer back-compatible for dynarray with 3.1.1 since June 1.

Re: dynarray

Posted: Sat Jul 14, 2018 7:33 pm
by PB
raananb wrote:

Code: Select all

#include <wx/dynarray.h>
WX_DECLARE_OBJARRAY(wxTextCtrl*, ArrayOfCFTextCtrlPointers);
What is the problem here?
As doublemax already said, you are not to use a pointer to the class in the declaration of wxObjArray. The documentation states that, e.g. here, but I guess it could be a bit clearer about that...

Re: dynarray

Posted: Thu Jul 19, 2018 8:11 am
by raananb
The compatibility break bug was reported and a patch was created to restore it (#18169).