From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fc95dcfbcc687cf9 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Help with some Code problems using C Interface Date: 2000/04/14 Message-ID: <8d7l1n$q6n$1@nnrp1.deja.com>#1/1 X-Deja-AN: 611188096 References: <38F742E3.71D536BE@arlut.utexas.edu> X-Http-Proxy: 1.0 x43.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Apr 14 17:38:01 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-04-14T00:00:00+00:00 List-Id: In article <38F742E3.71D536BE@arlut.utexas.edu>, Eric Bresie 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 > > 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.