comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Help with some Code problems using C Interface
Date: 2000/04/14
Date: 2000-04-14T00:00:00+00:00	[thread overview]
Message-ID: <8d7l1n$q6n$1@nnrp1.deja.com> (raw)
In-Reply-To: 38F742E3.71D536BE@arlut.utexas.edu

In article <38F742E3.71D536BE@arlut.utexas.edu>,
  Eric Bresie <bresie@arlut.utexas.edu> wrote:
> Okay...I am working on some ADA with some C function bindings.
>
> I have the following error being displayed when I compile the given
> code (spec and body) with the corresponding C code
> <errors>
> gnatbind -aO./ -aO. -I- -x tcim1.ali
> gnatlink -g tcim1.ali
> ./scsi_generic.o: In function `scsi_generic__inquiry':
> ./scsi_generic.adb:53: undefined reference to `scsi_inquiry'

This is usually a result of either specifying a slightly incorrect name
in the Ada interfacing pragma, or not linking against the object file
that contains the C routine. Judging from the gnatbind command, I'd say
its the latter. You need to reread the part of your compiler docs that
covers interfacing to C.


>         procedure SCSI_INQUIRY (
>                                 FD         : INTEGER;
>                                 LUN        : INTEGER;
>                                 INQ_BUFFER : SYSTEM.ADDRESS;
>                                 BYTECOUNT  : SYSTEM.ADDRESS;
>                                 ERROR      : SYSTEM.ADDRESS);
>         pragma INTERFACE (C, SCSI_INQUIRY);
>         pragma INTERFACE_NAME (SCSI_INQUIRY, "scsi_inquiry");

These are not Ada's standard C interfacing pragmas. They are custom ones
created by DEC for thier old Ada 83 VMS compiler, that Gnat included for
backwards compatability on that platform (even though they are now
redundant). I'm not saying you shouldn't use them. Just be advised that
if you do, this is not the correct place to ask questions about them.
You should go to the gnat-chat list instead. Here you're liable to get a
lot of responses that are unhelpful because people aren't familiar with
how these custom pragmas work.

The standard Ada way of doing this would be:
   pragma Import (C, SCSI_Inquiry, "scsi_inquiry");

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-04-14  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-14  0:00 Help with some Code problems using C Interface Eric Bresie
2000-04-14  0:00 ` Ted Dennison [this message]
2000-04-16  0:00   ` Simon Wright
2000-04-25  0:00 ` Erik Schalin
2000-04-25  0:00   ` David Starner
replies disabled

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