comp.lang.ada
 help / color / mirror / Atom feed
* Pragma and Object Files
@ 1998-04-13  0:00 Andy Pekrins
  1998-04-14  0:00 ` Geert Bosch
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Andy Pekrins @ 1998-04-13  0:00 UTC (permalink / raw)



I have asked several people about this, but
haven't received the answer I need.  I am
using GNAT 3.10p, and know how to use a
pragma to import from another language.

The problem I am having is figuring out
how to actually (physically) link my
object file, from say, an assembler, to
my Ada program.

Do I need to convert my OBJ file to an
Ada library file?  If so, how could I
go about doing that?

For clarity, let me run this down real quick.
I have an assembler object (OBJ) file that I
need to import a few functions from into my
Ada program.  How do I like that object file
with my Ada program?  I know how to import the
functions using "pragma import..."

Also, if anyone has any clues about how to use
interrupts or output data to a port using Ada,
please let me know.

Thanks
storm@vci.net





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-13  0:00 Pragma and Object Files Andy Pekrins
  1998-04-14  0:00 ` Geert Bosch
@ 1998-04-14  0:00 ` Jacob Sparre Andersen
  1998-04-14  0:00   ` William Tanksley
  1998-04-14  0:00 ` Anonymous
  2 siblings, 1 reply; 11+ messages in thread
From: Jacob Sparre Andersen @ 1998-04-14  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 894 bytes --]


Andy Pekrins (storm@vci.net) asked about using assembler object (OBJ) files
with GNAT 3.10p.

Since you identify the object file as an "OBJ" file rather than an "o" file,
I suspect that the object file is in a M$ format.

GNAT uses a different format for object files, so you will have to see if the
GNU assembler can convert your file.

Good luck.

Jacob

PS: I have never tried this myself, so I might be completely off track.

  ----------------------------------------------------------------------------
  --  Jacob Sparre Andersen     --  E-mail: Jacob.Sparre.Andersen@risoe.dk  --
  --  National Laboratory Ris�  --  Phone.: (+45) 46 77 51 23               --
  --  Systems Analysis          --  Fax...: (+45) 46 77 51 99               --
  ----------------------------------------------------------------------------

                        Have you played with your LEGO today?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-13  0:00 Pragma and Object Files Andy Pekrins
  1998-04-14  0:00 ` Geert Bosch
  1998-04-14  0:00 ` Jacob Sparre Andersen
@ 1998-04-14  0:00 ` Anonymous
  1998-04-14  0:00   ` Andy Perkins
  2 siblings, 1 reply; 11+ messages in thread
From: Anonymous @ 1998-04-14  0:00 UTC (permalink / raw)



On Mon, 13 Apr 1998 14:10:39 -0500, Andy Pekrins <storm@vci.net> wrote:

> I have asked several people about this, but
> haven't received the answer I need.  I am
> using GNAT 3.10p, and know how to use a
> pragma to import from another language.
> 
> The problem I am having is figuring out
> how to actually (physically) link my
> object file, from say, an assembler, to
> my Ada program.
> 
> ...

Pass the object file to the linker:

gnatmake main_subprogram_name -largs asembler_routine.obj

Jeff Carter  PGP:1024/440FBE21
My real e-mail address: ( carter @ innocon . com )
"Go and boil your bottom."
Monty Python & the Holy Grail

Posted with Spam Hater - see
http://www.compulink.co.uk/~net-services/spam/




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-13  0:00 Pragma and Object Files Andy Pekrins
@ 1998-04-14  0:00 ` Geert Bosch
  1998-04-14  0:00   ` Andy Perkins
  1998-04-14  0:00 ` Jacob Sparre Andersen
  1998-04-14  0:00 ` Anonymous
  2 siblings, 1 reply; 11+ messages in thread
From: Geert Bosch @ 1998-04-14  0:00 UTC (permalink / raw)



Two ways:
  1. Pass the name of the object as linker argument to the gnatmake program.
     See the GNAT User's Manual for more details.

  2. Use the pragma Linker_Options ("yourobject.o") to link in your
     object file. See Ada Reference manual.

Reading the manuals, doing the Lovelace Tutorial and studying a few
examples is definately worth your time. See www.adahome.com for all 
these things.

Regards,
   Geert




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-14  0:00 ` Anonymous
@ 1998-04-14  0:00   ` Andy Perkins
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Perkins @ 1998-04-14  0:00 UTC (permalink / raw)



Anonymous wrote:

> On Mon, 13 Apr 1998 14:10:39 -0500, Andy Pekrins <storm@vci.net> wrote:
>
> > The problem I am having is figuring out
> > how to actually (physically) link my
> > object file, from say, an assembler, to
> > my Ada program.
> >
> > ...
>
> Pass the object file to the linker:
>
> gnatmake main_subprogram_name -largs asembler_routine.obj

        I actually tried this before I posted that message.
        This causes an "unrecognized file format" error
        for the .obj file.  I believe the linker is looking for
        a GNAT .O object file...  Mine is an OBJ file
        coming from Borland's Turbo Assembler, and
        I have also tried MASM.

        storm@vci.net





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-14  0:00 ` Geert Bosch
@ 1998-04-14  0:00   ` Andy Perkins
  1998-04-16  0:00     ` Albert K. Lee
  0 siblings, 1 reply; 11+ messages in thread
From: Andy Perkins @ 1998-04-14  0:00 UTC (permalink / raw)



Geert Bosch wrote:

> Two ways:
>   1. Pass the name of the object as linker argument to the gnatmake program.
>      See the GNAT User's Manual for more details.
>
>   2. Use the pragma Linker_Options ("yourobject.o") to link in your
>      object file. See Ada Reference manual.

        The problem is that I don't have a .o file.  Mine is an obj file from
        Borland Turbo Assembler.  I can, of couse, tell there is a difference,
        but is there a way to convert an obj file to an o file?

        Thanks
        storm@vci.net





^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-14  0:00 ` Jacob Sparre Andersen
@ 1998-04-14  0:00   ` William Tanksley
  0 siblings, 0 replies; 11+ messages in thread
From: William Tanksley @ 1998-04-14  0:00 UTC (permalink / raw)



In article <6gvg24$m8u$1@news.uni-c.dk> sparre@meyer.fys.ku.dk (Jacob Sparre Andersen) writes:
>Andy Pekrins (storm@vci.net) asked about using assembler object (OBJ) files
>with GNAT 3.10p.

>Since you identify the object file as an "OBJ" file rather than an "o" file,
>I suspect that the object file is in a M$ format.

Agreed.

>GNAT uses a different format for object files, so you will have to see if the
>GNU assembler can convert your file.

The assembler won't help you at all -- object formats are not its job (and
it's not that good at its job anyways :).

There exists a program which converts from .obj to .o; I don't remember
anything useful about it, but you can almost certainly find some info at
DJ's web site at http://www.delorie.com/djgpp (this is the C compiler
whose backend is used as the backend for Gnat under DOS).  In the event
that nothing there helps, try asking the folk at news:comp.os.msdos.djgpp;
they've been quite helpful to me on occasion.

>Good luck.

Seconded.

>Jacob

>PS: I have never tried this myself, so I might be completely off track.

It's been quite a while... :)

>                        Have you played with your LEGO today?

-Billy




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-14  0:00   ` Andy Perkins
@ 1998-04-16  0:00     ` Albert K. Lee
  1998-04-16  0:00       ` Stephen Leake
  0 siblings, 1 reply; 11+ messages in thread
From: Albert K. Lee @ 1998-04-16  0:00 UTC (permalink / raw)



On Tue, 14 Apr 1998 13:11:00 -0500, Andy Perkins <storm@vci.net> wrote:
>Geert Bosch wrote:
>
>> Two ways:
>>   1. Pass the name of the object as linker argument to the gnatmake program.
>>      See the GNAT User's Manual for more details.
>>
>>   2. Use the pragma Linker_Options ("yourobject.o") to link in your
>>      object file. See Ada Reference manual.
>
>        The problem is that I don't have a .o file.  Mine is an obj file from
>        Borland Turbo Assembler.  I can, of couse, tell there is a difference,
>        but is there a way to convert an obj file to an o file?

An .obj file is an .o file, there is no difference ... DOS uses an
.obj file extension while many other OS's use .o instead.

-Albert




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-16  0:00     ` Albert K. Lee
@ 1998-04-16  0:00       ` Stephen Leake
  1998-04-16  0:00         ` Albert K. Lee
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Leake @ 1998-04-16  0:00 UTC (permalink / raw)



Albert K. Lee wrote:
> 
> On Tue, 14 Apr 1998 13:11:00 -0500, Andy Perkins <storm@vci.net> wrote:
> >Geert Bosch wrote:
> >
> >> Two ways:
> >>   1. Pass the name of the object as linker argument to the gnatmake program.
> >>      See the GNAT User's Manual for more details.
> >>
> >>   2. Use the pragma Linker_Options ("yourobject.o") to link in your
> >>      object file. See Ada Reference manual.
> >
> >        The problem is that I don't have a .o file.  Mine is an obj file from
> >        Borland Turbo Assembler.  I can, of couse, tell there is a difference,
> >        but is there a way to convert an obj file to an o file?
> 
> An .obj file is an .o file, there is no difference ... DOS uses an
> .obj file extension while many other OS's use .o instead.

Sorry, but no. There are many different object file formats. Borland,
Microsoft, and GNAT are all different from each other. I don't know of
any way to directly convert one format to another, but there may be
something like that in the gnu bintools (but gnu bintools probably don't
know about Borland object format!).

You'll have to compile the assembler code with the gnu assembler. I
don't know if the assembler syntax is the same; the opcode mnemonics
probably are, but the macro language is probably different.

Good Luck!

-- 
- Stephe




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-16  0:00       ` Stephen Leake
@ 1998-04-16  0:00         ` Albert K. Lee
  1998-04-21  0:00           ` William Tanksley
  0 siblings, 1 reply; 11+ messages in thread
From: Albert K. Lee @ 1998-04-16  0:00 UTC (permalink / raw)



On Thu, 16 Apr 1998 10:56:04 -0400, Stephen Leake <Stephen.Leake@gsfc.nasa.gov> wrote:
>Albert K. Lee wrote:
>> 
>> An .obj file is an .o file, there is no difference ... DOS uses an
>> .obj file extension while many other OS's use .o instead.
>
>Sorry, but no. There are many different object file formats. Borland,
>Microsoft, and GNAT are all different from each other. I don't know of
>any way to directly convert one format to another, but there may be
>something like that in the gnu bintools (but gnu bintools probably don't
>know about Borland object format!).
>
>You'll have to compile the assembler code with the gnu assembler. I
>don't know if the assembler syntax is the same; the opcode mnemonics
>probably are, but the macro language is probably different.
>
>Good Luck!

Sorry.  Where I come from (that is, the distant past), Intel specified
a common .obj format.  MASM code was easily linked with Turbo Pascal
and so on.  Is this not the case anymore?




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Pragma and Object Files
  1998-04-16  0:00         ` Albert K. Lee
@ 1998-04-21  0:00           ` William Tanksley
  0 siblings, 0 replies; 11+ messages in thread
From: William Tanksley @ 1998-04-21  0:00 UTC (permalink / raw)



In article <slrn6jcp90.agb.aklee@interport.net> aklee@spam.this.interport.net (Albert K. Lee) writes:

>Sorry.  Where I come from (that is, the distant past), Intel specified
>a common .obj format.  MASM code was easily linked with Turbo Pascal
>and so on.  Is this not the case anymore?

Your past isn't quite as distant as you might like to think.  Actually,
the a.out format used in Unix (generally using the .o prefix) was a lot
older than Intel.

The stuff produced by gcc anymore is usually in COFF format, which is now
being adopted by just about everyone (even MS uses a bastardized version
of COFF).

Thus, what you need is a obj2coff program, like I posted last time.  Are
my posts not propagating?  If not, you ought to be able to find one (fr
DOS) at http://www.delorie.com/djgpp.

-Billy




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~1998-04-21  0:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-13  0:00 Pragma and Object Files Andy Pekrins
1998-04-14  0:00 ` Geert Bosch
1998-04-14  0:00   ` Andy Perkins
1998-04-16  0:00     ` Albert K. Lee
1998-04-16  0:00       ` Stephen Leake
1998-04-16  0:00         ` Albert K. Lee
1998-04-21  0:00           ` William Tanksley
1998-04-14  0:00 ` Jacob Sparre Andersen
1998-04-14  0:00   ` William Tanksley
1998-04-14  0:00 ` Anonymous
1998-04-14  0:00   ` Andy Perkins

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