comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex Mentis" <foo@invalid.invalid>
Subject: Import pragma question
Date: Wed, 23 Mar 2011 08:25:00 +0000 (UTC)
Date: 2011-03-23T08:25:00+00:00	[thread overview]
Message-ID: <imcaor$u2l$1@news.eternal-september.org> (raw)

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



             reply	other threads:[~2011-03-23  8:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  8:25 Alex Mentis [this message]
2011-03-23  8:45 ` Import pragma question Pascal Obry
2011-03-23  8:45 ` Pascal Obry
2011-03-23  9:06   ` Alex Mentis
2011-03-23 16:51 ` Jeffrey Carter
2011-03-23 17:40   ` Alex Mentis
replies disabled

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