home *** CD-ROM | disk | FTP | other *** search
- -- ++
- -- A simple test for interfacing C to Ada. This example is from the AdaEd
- -- documentation.
- -- --
-
- procedure C_INTERFACES is
- type ARA10 is array(1..10) of INTEGER;
- A10: ARA10 := (1,2,3,4,5,6,7,8,9,10);
-
- procedure PRINTA(A:ARA10);
- -- PRINTA prints an array of 10 elements of type INTEGER
- pragma INTERFACE(C, PRINTA);
-
- procedure PRINTS1(A:STRING; LEN: INTEGER);
- -- PRINTS1 prints an array of LEN elements of type CHARACTER
- pragma INTERFACE(C, PRINTS1);
-
- procedure PRINTS(A:STRING) is
- -- This routine prints a string by passing the string and its length
- -- to the routine PRINTS1 which is written in C.
- begin
- PRINTS1(A, A'length);
- end;
-
- begin
- PRINTA(A10);
- PRINTS("this is any string");
- end;
-