< Ada Programming < Pragmas

Ada. Time-tested, safe and secure.
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.
Example
/* C file */ int my_C_function() { return 1; }
-- Ada Filefunction
My_C_Functionreturn
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!
See also
Wikibook
- Ada Programming
- Ada Programming/Pragmas
- Ada Programming/Pragmas/Export
- Ada Programming/Pragmas/Convention
- Ada Programming/Pragmas/Linker Options
- Ada Programming/Pragmas/Interface (obsolescent)
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.