Next: Generic Categorized Units, Previous: Pragma Asynchronous, Up: More About Categorization Pragmas

##### 8.1.7.5 Pragma All_Calls_Remote

A pragma All_Calls_Remote in a RCI unit forces remote procedure calls to be routed through the communication subsystem even for a local call. This eases the debugging of an application in a non-distributed situation that is very close to the distributed one, because the communication subsystem (including marshalling and unmarshalling procedures) can be exercised on a single node.

In some circumstances, a non-distributed application can behave differently from an application distributed on only one partition. This can happen when both All_Calls_Remote and Asynchronous features are used at the same time (see Pragma Asynchronous for an example). Another circumstance occurs when the marshalling operations raise an exception. In the following example, when unit ACRRCI is a All_Calls_Remote package, the program raises Program_Error. When unit ACRRCI is no longer a All_Calls_Remote package, then the program completes silently.

         with Ada.Streams; use Ada.Streams;
         package ACRRT is
            pragma Remote_Types;
            type T is private;
         private
            --  implementation removed
         end ACRRT;

         package body ACRRT is
            procedure Read
              (S : access Root_Stream_Type'Class;
               X : out T) is
            begin
               raise Program_Error;
            end Read;

            procedure Write
              (S : access Root_Stream_Type'Class;
               X : in T) is
            begin
               raise Program_Error;
            end Write;
         end ACRRT;

         with ACRRT; use ACRRT;
         package ACRRCI is
            pragma Remote_Call_Interface;
            pragma All_Calls_Remote;

            procedure P (X : T);
         end ACRRCI;

         package body ACRRCI is
            procedure P (X : T) is
            begin
               null;
            end P;
         end ACRRCI;

         with ACRRCI, ACRRT;
         procedure ACRMain is
            X : ACRRT.T;
         begin
            ACRRCI.P (X);
         end ACRMain;