PowerAda Interface to Other Languages
This chapter describes how you can call subprograms and access data written in other languages, including C, C++, and FORTRAN from a PowerAda program, and vice versa. It also describes how to bind mixed-language programs containing Ada.
Before reading this chapter, you should be familiar with the non-Ada language that you are working with, and the calling conventions for non-Ada subprograms that are described in AIX Commands Reference for IBM RISC System/6000. You should already understand the ada command and its options for compiling programs.
After reading this chapter, you should be able to use pragma Import in your PowerAda programs to call C, C++, and FORTRAN subprograms. You should understand how Ada data types and objects correspond to equivalent types and objects in other languages. You should understand how to use pragma Import in accessing data declared in C code from Ada code. You should understand how to use pragma Export to allow C code to access objects declared in Ada code. You should be able to use pragma Export to allow a C routine to call an Ada subprogram. After writing a mixed-language program, you should be able to perform any special steps needed to compile and link it.