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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,60beaed5c57d54d,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Alex Mentis" Newsgroups: comp.lang.ada Subject: Import pragma question Date: Wed, 23 Mar 2011 08:25:00 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 23 Mar 2011 08:25:00 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="TfaOIE1E70h9psK9x8LxRg"; logging-data="30805"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19k7JlDGI8cn3uWe/oa5SfOknEKy1aNA/I=" User-Agent: XanaNews/1.19.1.269 Cancel-Lock: sha1:MH0CkyA/iN9UoBJz94cSqd6BWZ4= Xref: g2news2.google.com comp.lang.ada:19365 Date: 2011-03-23T08:25:00+00:00 List-Id: I've never interfaced Ada with other languages, so I have some questions about pragma Import. How does an import pragma know where to find the non-Ada code to be used for the import? As an illustration of my question, I'll use the GNAT.IO package (g-io.adb) from GNAT 4.3.6. In g-io.adb, pragma Import is used to import a C function "get_char" and associate it with the Ada function Get_Char (lines 53-54). The C function get_char code is in the file cio.c, located in the same directory as g-io.adb, but how does the pragma know this? Does it use the convention parameter to check all .c files in the current directory for a function of the specified external name? What if multiple .c files in the current directory have a get_char function? Could the .c file containing the code to be imported be located in a different directory? If so, how does the import find it? Thank you for helping me advance my understanding. Alex