Talk About Network

Google





Programming > Ada > Re: How to exte...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 11 Topic 5742 of 6006
Post > Topic >>

Re: How to extend packages

by "snoopysalive@[EMAIL PROTECTED] " <snoopysalive@[EMAIL PROTECTED] > Jun 7, 2008 at 02:50 PM

Ok, I've tried out S=E9bastien Morand's solution but it's still not
working. To be honest, it's possible that I'm just using the compiler
in a wrong way.

Here's my code:

------------------
-- s-regext.ads --
------------------

with System.Regpat;

package System.Regpat.Extended is
end System.Regpat.Extended;

------------------
-- s-regext.adb --
------------------

pragma No_Body;

-------------
-- rex.adb --
-------------

with System.Regpat.Extended;

procedure Rex is
begin
   null;
end Rex;



When compiling I get this messages:

$ gnatmake rex.adb
gnatbind -x rex.ali
error: "s-regext.ali" not found, "s-regext.ads" must be compiled
gnatmake: *** bind failed.


So, I try to comile s-regext.ads first and get this message:

$ gnatmake s-regext.ads
gnatmake: not allowed to compile "s-regext.ads"; use -a switch, or
compile file with "-gnatg" switch


When trying the -a switch:

$ gnatmake -a s-regext.ads
gcc -gnatpg -c s-regext.ads
s-regext.ads:1:12: warning: no entities of "Regpat" are referenced
gnatmake: "s-regext.ads" compilation error


When trying the -gnatg switch:

$ gnatmake -gnatg s-regext.ads
gnatmake: not allowed to compile "s-regext.ads"; use -a switch, or
compile file with "-gnatg" switch


I don't really understand what's happening here because when
simulating this kind of "inheritance" with packages written by myself,
it is working. Here's the example code:

--------------
-- test.ads --
--------------

with Ada.Text_IO;

package Test is

	procedure Say_Hello;

end Test;


--------------
-- test.adb --
--------------

package body Test is

	procedure Say_Hello is
	begin
		Ada.Text_IO.Put_Line ("Say_Hello");
	end Say_Hello;

end Test;


------------------
-- test-run.ads --
------------------

with Test;

package Test.Run is

	procedure Say_Something;

end Test.Run;


------------------
-- test-run.adb --
------------------

package body Test.Run is
	use Test;

	procedure Say_Something is
	begin
		Ada.Text_IO.Put_Line ("Say_Something");
	end Say_Something;

end Test.Run;


--------------
-- main.adb --
--------------

with Test.Run;

procedure Main is
begin
	Test.Say_Hello;
	Test.Run.Say_Something;
end Main;



$ gnatmake main.adb
gcc -c main.adb
gnatbind -x main.ali
gnatlink main.ali

$ ./main
Say_Hello
Say_Something


So, it seems as if it's not possible to extend packages of the
standard library. Or am I interpreting this in a wrong way?

Last but not least: Thanks for all your answers to my question.

Thanks,
Matthias
 




 11 Posts in Topic:
How to extend packages
"snoopysalive@[EMAIL  2008-06-06 10:00:02 
Re: How to extend packages
witmer <witmer@[EMAIL   2008-06-06 10:24:49 
Re: How to extend packages
=?ISO-8859-1?Q?S=E9bastie  2008-06-06 17:45:15 
Re: How to extend packages
Stephen Leake <Stephe.  2008-06-07 10:21:30 
Re: How to extend packages
Simon Wright <simon.j.  2008-06-07 17:04:57 
Re: How to extend packages
Georg Bauhaus <rm.tsoh  2008-06-06 20:16:33 
Re: How to extend packages
"snoopysalive@[EMAIL  2008-06-07 14:50:07 
Re: How to extend packages
Simon Wright <simon.j.  2008-06-08 12:09:35 
Re: How to extend packages
"snoopysalive@[EMAIL  2008-06-09 15:38:30 
Re: How to extend packages
Simon Wright <simon.j.  2008-06-10 06:40:40 
Re: How to extend packages
"snoopysalive@[EMAIL  2008-06-14 01:45:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 11:35:39 PST 2009.