comp.lang.ada
 help / color / mirror / Atom feed
From: Michal Nowak <vinnie@inetia.pl>
Subject: Re: Placement of pragma Import
Date: Sun, 08 Dec 2002 16:08:16 +0100
Date: 2002-12-08T16:08:16+01:00	[thread overview]
Message-ID: <mailman.1039359543.10328.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <x7vk7ikr92b.fsf@smaug.pushface.org>

On 2002-12-08 at 12:26 Simon Wright wrote:

>Michal Nowak <vinnie@inetia.pl> writes:
>
>> -- 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;
>
>I would certainly use the second choice; it probably makes no
>difference to the generated code, but it removes complication from the
>public part of the spec.

Yes, I agree, that it looks better to put it in private section. 
However I want to be aware what I'm doing and what consequences it
may have. The disassembled main executable differs a bit in these
two cases. I'll try to analyze it a more deeper, although I'm not
an assembly guru, so I'm not sure if I understand it properly.

>By the way, I think you meant nothing_asm.o, not nothing_asm.s?

Well, yes and...no. When you pointed me this I recalled, that 
in my work some time ago I did it by passing the ".o" file as
an argument (under ObjectAda). But the posted code I compiled
under GNAT and it worked. Now I read RM and it says B.1 (37):

37    Pragma Linker_Options has the effect of passing its string
argument as a parameter to the system linker (if one exists), if
the immediately enclosing compilation unit is included in the 
partition being linked. The interpretation of the string argument,
and the way in which the string arguments from multiple Linker_Options
pragmas are combined, is implementation defined.

So if I understood it correctly, it depends from implementation
how it is processed. Seems GNAT compilation system is intelligent
enough to compile the assembly source first and then link it.

   - Michal


"<<Over 50,000 lines of code, 
   you probably should be programming in Ada.>>
Whoever said that, he's right."





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

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-08 10:23 Placement of pragma Import Michal Nowak
2002-12-08 12:26 ` Simon Wright
2002-12-08 15:08   ` Michal Nowak [this message]
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
     [not found] <200212081123160930.0047D332@smtp-po.inetia.pl>
2002-12-08 11:12 ` David C. Hoos, Sr.
2002-12-08 18:49   ` tmoran
     [not found] ` <053001c29eaa$ad9b72f0$6500000a@dhoos>
2002-12-08 15:07   ` 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