From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,95dad6602b955ce1,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "Lucretia" Newsgroups: comp.lang.ada Subject: [wxAda] Problem with "limited with" in a *real* application Date: 11 Oct 2005 08:17:01 -0700 Organization: http://groups.google.com Message-ID: <1129043820.987947.200870@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 194.74.199.42 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1129043826 28274 127.0.0.1 (11 Oct 2005 15:17:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 11 Oct 2005 15:17:06 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 Symantec_Web_Security (3.0.1.74), 1.0 C2100-0050414028 (NetCache NetApp/5.5R5) Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=194.74.199.42; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news1.google.com comp.lang.ada:5546 Date: 2005-10-11T08:17:01-07:00 List-Id: I have a type hierarchy which is rooted at wx.Factory.Factory_Type, inside this package there is a function which allows the programmer to get the C++ pointer to the wx instance for any wxAda type (Get_wxObject). package wx.Factory is -- This is the base type of all wxAda types. type Factory_Type is new Ada.Finalization.Limited_Controlled with private; ... function Get_wxObject(Self : in Factory_Type) return System.Address; ... end wx.Factory; Inside wx.Core.Sizer I have a Set_Sizer procedure which actually belongs to the wxWindow class and thus should be inside wx.Core.Window. It cannot go there currently, because of cyclic dependencies (wx.Core.Sizer also requires access to wx.Core.Window). I have tried to get this working using Ada 2005's "limited with" but for some reason I just cannot get it to compile. I think wx.Core.Window needs to have the full view of the Sizer_Type. limited with wx.Core.Sizer; package wx.Core.Window is type Window_Type is new Event_Handler_Type with private; procedure Set_Sizer( Self : in Window_Type; Sizer : access wx.Core.Sizer.Sizer_Type; Delete_Old_Sizer : in Boolean := True); end wx.Core.Window; package body wx.Core.Window is procedure Set_Sizer( Self : in Window_Type; Sizer : access wx.Core.Sizer.Sizer_Type; Delete_Old_Sizer : in Boolean := True) is procedure wxWindow_SetSizer( Self, Sizer : in System.Address; Delete_Old_Sizer : in C.int); pragma Import(C, wxWindow_SetSizer, "wxWindow_SetSizer"); Delete_Old_Sizer_Converted : C.int := 0; begin if Delete_Old_Sizer = True then Delete_Old_Sizer_Converted := 1; end if; wxWindow_SetSizer(Get_wxObject(Self), Get_wxObject(Sizer.all), Delete_Old_Sizer_Converted); end Set_Sizer; end wx.Core.Window; $ gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1-20050902/configure --prefix=/opt/gcc-4.1-20050902 --enable-libada --enable-languages=c,c++,objc,ada Thread model: posix gcc version 4.1.0 20050902 (experimental) ... gcc -c -g -gnatf -gnatwj -gnat05 wx-core-window.adb wx-core-window.adb:751:43: no candidate interpretations match the actuals: wx-core-window.adb:751:62: missing with_clause for scope of imported type "Sizer.Sizer_Type" wx-core-window.adb:751:62: ==> in call to "get_wxobject" at wx-core-window.ads:22(inherited) wx-core-window.adb:751:62: ==> in call to "get_wxobject" at wx-core-colour.ads:9(inherited) wx-core-window.adb:751:62: ==> in call to "get_wxobject" at wx-base-event_handler.ads:17(inherited) wx-core-window.adb:751:62: ==> in call to "get_wxobject" at wx-base-event.ads:18(inherited) wx-core-window.adb:751:62: ==> in call to "get_wxobject" at wx-base-object.ads:21(inherited) wx-core-window.adb:751:62: ==> in call to "Get_wxObject" at wx-factory.ads:32 gnatmake: "wx-core-window.adb" compilation error raised MAKE.COMPILATION_FAILED : make.adb:4791