comp.lang.ada
 help / color / mirror / Atom feed
From: "Lucretia" <lucretia9@lycos.co.uk>
Subject: Re: Problem with "limited with" in a *real* application
Date: 13 Oct 2005 07:50:04 -0700
Date: 2005-10-13T07:50:04-07:00	[thread overview]
Message-ID: <1129215004.069760.84050@g49g2000cwa.googlegroups.com> (raw)
In-Reply-To: 1129136767.955381.143030@g47g2000cwa.googlegroups.com

Ok, so I tried the above and got it compiling, so I tried to remove the
"access" in an attempt to make the interface a bit cleaner and there
are more problems...

<wx.Core.Window>
...
limited with wx.Core.Sizer;

package wx.Core.Window is

  -- This is the actual type (wxWindow) we are creating here.
  type Window_Type is new Event_Handler_Type with private;

  ...
  procedure Set_Sizer(
    Self : in Window_Type;
    Sizer : in wx.Core.Sizer.Sizer_Type;
    Delete_Old_Sizer : in Boolean := True);
  ...

end wx.Core.Window;
</wx.Core.Window>

<wx.Core.Window>
...
with wx.Core.Sizer; use wx.Core.Sizer;

package body wx.Core.Window is

  ...

  procedure Set_Sizer(
    Self : in Window_Type;
    Sizer : in 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),
Delete_Old_Sizer_Converted);

  end Set_Sizer;

  ...

end wx.Core.Window;
</wx.Core.Window>

I've had to cast the sizer type to the base sizer in the Set_Sizer
procedure call:

<Minimal_Frame>
package body Minimal_Frame is

  ...

  procedure New_Minimal_Frame(Self : in out Minimal_Frame_Type) is

    ...

  begin

    ...
    Set_Sizer(Window_Type(Self.Panel), Sizer_Type(Self.Sizer));
    ...

  end New_Minimal_Frame;

  ...

end Minimal_Frame;
</Minimal_Frame>

But for some reason, the app won't link because Set_Sizer is undefined:

<log>
gnatlink minimal.ali -o minimal -lwxada -L../../src
-L/home/laguest/opt/wxGTK/lib -pthread -lwx_gtk2d_xrc-2.6
-lwx_gtk2d_qa-2.6 -lwx_gtk2d_html-2.6 -lwx_gtk2d_dbgrid-2.6
-lwx_gtk2d_adv-2.6 -lwx_gtk2d_core-2.6 -lwx_based_odbc-2.6
-lwx_based_xml-2.6 -lwx_based_net-2.6 -lwx_based-2.6
../../src/ada/wx-core-window.o(.text+0x5b37): In function
`wx.core.window._elabs':
/home/laguest/src/svn-controlled/wxAda/src/ada/wx-core-window.ads:318:
undefined reference to `wx__core__window__set_sizer'
../../src/ada/wx-core-window.o(.text+0x5b48):/home/laguest/src/svn-controlled/wxAda/src/ada/wx-core-window.ads:318:
undefined reference to `wx__core__window__set_sizer'
./minimal_frame.o(.text+0x11d5): In function
`minimal_frame.new_minimal_frame':
/home/laguest/src/svn-controlled/wxAda/samples/minimal/minimal_frame.adb:214:
undefined reference to `wx__core__window__set_sizer'
collect2: ld returned 1 exit status
gnatlink: cannot call /opt/gcc-4.1-20050902/bin/gcc
</log>

And, yes wx-core-window.ad[sb] is getting compiled, I have already mde
sure of that by deleting the object and then recompiling and then doing
an objdump on wx-core-window.o only to find that set_sizer is undefined
for some reason!

But, ultimately I don't want to be casting all the time, so if I change
the specification of the procedure of Set_Sizer to read:

<wx.Core.Window>
  ...
  procedure Set_Sizer(
    Self : in Window_Type;
    Sizer : in wx.Core.Sizer.Sizer_Type'Class;
    Delete_Old_Sizer : in Boolean := True);
  ...
</wx.Core.Window>

and similarly in the body, things gets even weirder:

<log>
gcc -c -g -gnatf -gnatwj -gnat05 wx-core-window.adb
wx-core-window.adb:737:46: not type conformant with declaration at
wx-core-window.ads:141
wx-core-window.adb:737:46: type of "Sizer" does not match
gnatmake: "wx-core-window.adb" compilation error
</log>

What's going on in these cases?

Thanks,
Luke.




  reply	other threads:[~2005-10-13 14:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-11 15:17 [wxAda] Problem with "limited with" in a *real* application Lucretia
2005-10-11 21:23 ` Randy Brukardt
2005-10-12 17:06   ` Lucretia
2005-10-13 14:50     ` Lucretia [this message]
2005-10-13 16:18       ` Lucretia
2005-10-14  0:36         ` Randy Brukardt
2005-10-14 15:03           ` Lucretia
2005-10-14 23:47             ` Randy Brukardt
2005-10-15 13:48               ` Lucretia
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox