File: call_cpp.adb

package info (click to toggle)
gprbuild 2014dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,564 kB
  • ctags: 195
  • sloc: ada: 110,384; xml: 3,632; sh: 2,810; makefile: 363; ansic: 204; cpp: 89; fortran: 62; asm: 27
file content (23 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
with Text_IO; use Text_IO;

procedure Call_CPP is
   procedure cpp_routine;
   pragma Import (C, cpp_routine);
   Error : exception;

   procedure Raise_And_Catch is
   begin
      Put ("in Ada: raise ...  ");
      raise Error;
   exception
      when Error =>
         Put_Line ("and catch!");
   end Raise_And_Catch;

begin
   Put_Line ("In Call_CPP");
   Raise_And_Catch;
   cpp_routine;
   Put_Line ("Back in Call_CPP");
   Raise_And_Catch;
end Call_CPP;