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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fc95dcfbcc687cf9,start X-Google-Attributes: gid103376,public From: Eric Bresie Subject: Help with some Code problems using C Interface Date: 2000/04/14 Message-ID: <38F742E3.71D536BE@arlut.utexas.edu>#1/1 X-Deja-AN: 611167269 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: news@arlut.utexas.edu X-Trace: ns3.arlut.utexas.edu 955728399 31545 129.116.136.159 (14 Apr 2000 16:06:39 GMT) Organization: Applied Research Laboratories - The University of Texas at Austin Mime-Version: 1.0 NNTP-Posting-Date: 14 Apr 2000 16:06:39 GMT Newsgroups: comp.lang.ada Date: 2000-04-14T16:06:39+00:00 List-Id: 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 There are a number of similar problems, but I figured I would try and handle one since the others should be the same. I have included only the related code. Hopefully you can see my method of seperating the sections....I have XML in the brain at the moment :-) I am sure this is a simple matter of a typo somewhere so any help would be appreciated. Eric Bresie ebresie@usa.net 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' gnatmake: *** link failed. Compilation exited abnormally with code 4 at Fri Apr 14 10:33:48 function INQUIRY (FILE : OS_CALLS.FILE_DESCRIPTOR) return STRING; -- scsi inquiry -- function INQUIRY ( FILE : OS_CALLS.FILE_DESCRIPTOR) return STRING is 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"); INQ_BUFFER : STRING (1..200); ERROR : INTEGER; LUN : INTEGER := 0; CNT : INTEGER := 0; begin SCSI_INQUIRY (INTEGER (FILE), -- this is line 53 of scsi_generic.adb LUN, INQ_BUFFER(1)'ADDRESS, CNT'ADDRESS, ERROR'ADDRESS); return INQ_BUFFER; end INQUIRY; /* scsi_inquiry(file descriptor, lun, buffer, error) */ void scsi_inquiry (int, int, char *, int *, int *); /* * SCSI inquiry command. */ void scsi_inquiry (int fd, int lun, char * buffer, int *bytecount, int * error) { int i; static unsigned char scsi_command[INQUIRY_CMD_LEN]; scsi_command[0] = INQUIRY_CMD; /* command */ scsi_command[1] = (lun << LUN_OFFSET_SHIFT); /* lun/reserved */ scsi_command[2] = 0; /* page code */ scsi_command[3] = 0; /* reserved */ scsi_command[4] = INQUIRY_REPLY_LEN; /* allocation length */ scsi_command[5] = 0; /* reserved/flag/link */ *error = sg_command ( fd, scsi_command, /* scsi command */ INQUIRY_CMD_LEN, /* command descriptor length */ 0, /* input buffer */ 0, /* input size */ buffer, /* output buffer */ INQUIRY_REPLY_LEN); /* output size */ if ( *error >= 0 ) *bytecount = *error; for (i = 0; i < INQUIRY_REPLY_LEN - 8; i++) buffer[i] = buffer[i+8]; }