kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #13082
Re: Question about kifaced globals
On 04/20/2014 04:09 AM, Lorenzo Marcantonio wrote:
> It a misconception of mine or globals can't be "split"?
>
> I.e. if for some reason you instance two pcbnew in the same process all
> the globals (and class/function static) become shared?
>
> Could this give problem? Is there some data/BSS trick to avoid it?
>
Yes globals are global. Most of them are now a problem, now that I have my mind set on
supporting multiple instances of the same KIWAY_PLAYER types in the same process. I have
spoken to Wayne about this and it is on its way into the roadmap as a soon TODO item.
In some cases we actually need globals, so some percentage of them can stay global. The
others will have to made instance specific. I recommended that those be put into a
containing struct, and then that struct be held in the PROJECT or held in the wxFrame.
Those two objects, the PROJECT and the wxFrame are instance specific. The wxFrame is also
purpose specific, whereas the PROJECT is cross purpose. This provides an opportunity to
use both of these boxes, and sort the problem globals into the proper box.
Also note that we are talking about a handful of wxFrames, so you have a handful of boxes
available, not just two. You have one PROJECT and multiple wxFrames.
This kind of sorting is really not much more than that, sorting followed by search and
replace. It should not be made into a mountain of work.
Dick
Follow ups
References