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 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Help with some Code problems using C Interface Date: 2000/04/16 Message-ID: #1/1 X-Deja-AN: 611899788 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: <38F742E3.71D536BE@arlut.utexas.edu> <8d7l1n$q6n$1@nnrp1.deja.com> X-Trace: news.demon.co.uk 955905178 nnrp-13:1396 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 2000-04-16T00:00:00+00:00 List-Id: Ted Dennison writes: > 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. And the gnatmake command you should use probably looks something like gnatmake tcim1 -largs scsi_inquiry.o ie you need to tell gnatmake where to find this function you've invented. I'm assuming the file name convention, of course, perhaps it's in scim1.o :-) You might just possibly find it useful to look at pragma Link_Options -- however, in my experience that's only really helpful for little programs, as soon as things start being spread over multiple directories, or if you have multiple libraries with order dependence, it all breaks down.