comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Placement of pragma Import
Date: Sun, 8 Dec 2002 05:12:14 -0600
Date: 2002-12-08T05:12:14-06:00	[thread overview]
Message-ID: <mailman.1039345982.3581.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 200212081123160930.0047D332@smtp-po.inetia.pl

In my opinion, the best place to put it would be in the package
body.  After all, what you're declaring with the pragma Import
is the _implementation_ of the procedure Asm_Coded.

The fact that you're importing the implementation has nothing
whatever to do with the specification, so it should not
appear there.

David C. Hoos

----- Original Message ----- 
From: "Michal Nowak" <vinnie@inetia.pl>
To: "comp.lang.ada usegroup->mailing list gateway" <comp.lang.ada@ada.eu.org>
Sent: December 08, 2002 4:23 AM
Subject: Placement of pragma Import


> Hello all,
> 
> I have a little question coming out of curiosity.
> 
> I have an assembly routine (in fact it may be a C code,
> or something other, it does not matter).
> I'm importing this subroutine in a package. It is possible
> to place pragma Import in two (maybe more?) places:
> 
> -- Possibility 1:
> 
> package Import_Test is
>    
>    procedure Asm_Coded;
> 
>    pragma Import (Assembler, Asm_Coded, "donothing");   
>    pragma Linker_Options ("nothing_asm.s");      
>    
> end Import_Test;
> 
> -- Possibility 2:
> package Import_Test is
>    
>    procedure Asm_Coded;
> 
> private   -- Imported in private section
> 
>    pragma Import (Assembler, Asm_Coded, "donothing");
>    pragma Linker_Options ("nothing_asm.s");      
>    
> end Import_Test;
> 
> And a simple program which makes use of the above package:
> ---------------------------------
> with Import_Test;
> 
> procedure Test is
> begin
>    Import_Test.Asm_Coded;
> end Test;
> ---------------------------------
> 
> The generated assembly source for Import_Test and Test subprogram 
> is the same in both cases. The program behaves and links in the
> same way in both cases, but such test is not a proper way to say
> if something is correct (?) or not.
> I disassembled the main executable file with objdump and there are
> some differences. However, this analysis didn't gave me answer to
> what I want to know:
> - what is the difference between 1st and 2nd possibility (from Ada
>   point of view)?
> - if there is a difference, how does it affect program behavior,
>   visibility rules, etc.?
> - if there is no difference, why?
> 
> Thanks for any info,
>    - Michal
> 
> 
> -- -----------------------------------------------------------------
> --   ___        _
> --  / _ \      | |                      I Choose Ada:
> -- | |_| |  ___| |   _____   The Most Trusted Name in Software (TM)
> -- |  _  | | __  |  | __  | 
> -- |_| |_| |_____|_ |_____|_ http://www.adaic.org/whyada/choose.html
> --
> -- -----------------------------------------------------------------
> 
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
> 
> 




       reply	other threads:[~2002-12-08 11:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200212081123160930.0047D332@smtp-po.inetia.pl>
2002-12-08 11:12 ` David C. Hoos, Sr. [this message]
2002-12-08 18:49   ` Placement of pragma Import tmoran
     [not found] ` <053001c29eaa$ad9b72f0$6500000a@dhoos>
2002-12-08 15:07   ` Michal Nowak
2002-12-08 10:23 Michal Nowak
2002-12-08 12:26 ` Simon Wright
2002-12-08 15:08   ` Michal Nowak
2002-12-08 18:46     ` Jeffrey Carter
2002-12-08 19:46       ` Dennis Lee Bieber
2002-12-08 21:08         ` James S. Rogers
2002-12-09  1:21         ` Jeffrey Carter
2002-12-09  4:47           ` Dennis Lee Bieber
2002-12-09 21:56         ` Michal Nowak
2002-12-08 22:40       ` Martin Dowie
2002-12-09  1:42         ` Jeffrey Carter
2002-12-09  7:00           ` Martin Dowie
2002-12-10  2:04           ` Randy Brukardt
2002-12-09 21:55       ` Michal Nowak
2002-12-10  1:32         ` Jeffrey Carter
2002-12-09 14:34     ` Wes Groleau
2002-12-09 21:56       ` Michal Nowak
2002-12-08 18:44 ` Jeffrey Carter
2002-12-09 21:55   ` Michal Nowak
replies disabled

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