Ada Programming/Pragmas/Import
From Wikibooks, open books for an open world
Contents |
[edit] Summary
The pragma Import directs the compiler to use code or data objects written in a foreign computer language.
Which foreign languages are supported depends on the compiler implementation. Typically C, C++, Cobol, and Fortran are supported.
[edit] Example
/* C file */
int my_C_function() {
return 1;
}
-- Ada File function My_C_Function return Integer; pragma Import (Convention => C, Entity => My_C_Function, External_Name => "my_C_function" ); ... Some_Variable := My_C_Function; -- Ada uses a foreign language like a pro! -- Huzzah!