comp.lang.ada
 help / color / mirror / Atom feed
* Import pragma question
@ 2011-03-23  8:25 Alex Mentis
  2011-03-23  8:45 ` Pascal Obry
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alex Mentis @ 2011-03-23  8:25 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-23 17:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23  8:25 Import pragma question Alex Mentis
2011-03-23  8:45 ` 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

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