Sample ILC applications

@PROCESS LIST                                                    
      PROGRAM CEFO2CP                                            
*   Module/File Name: AFHCPFOR                                   
*************************************************************    
*    FUNCTION   :  Interlanguage communications call to     *
*                  a C++ program.                           *
*                                                           *
*    This example illustrates an interlanguage call from    *
*    a Fortran main program to a C++ function.              *
*    The parameters passed across the call from Fortran     *
*    to C++ have the following declarations:                *
*                                                           *
*    Fortran INTEGER*2    to C++ short as pointer           *
*    Fortran INTEGER*4    to C++ int                        *
*    Fortran REAL*4       to C++ float                      *
*    Fortran REAL*8       to C++ double                     *
*    Fortran CHARACTER*23 to C++ as char                    *
*************************************************************   
*************************************************************   
*    DECLARATIONS OF VARIABLES FOR THE CALL TO C++          *
*************************************************************   
      INTEGER*4        J
      EXTERNAL         CECFFOR
      INTEGER*4        CECFFOR
      INTEGER*2        FOR_SHORT         / 15 /
      INTEGER*4        FOR_INT           / 31 /
      REAL*4           FOR_FLOAT         / 53.99999 /
      REAL*8           FOR_DOUBLE        / 3.14159265358979312D0 /
      CHARACTER*23     CHARSTRING        /'PASSED CHARACTER STRING'/
*************************************************************        
*     PROCESS STARTS HERE                                   *
*************************************************************        
      PRINT *, '*****************************************'
      PRINT *, 'FORTRAN CALLING C++ EXAMPLE STARTED'    *
      PRINT *, '*****************************************'
      FOR_POINTER = LOC(CHARSTRING)                                   
      PRINT *, 'CALLING C++ DUNCTION'                                 
      J = CECFFOR( FOR_SHORT, FOR_INT, FOR_FLOAT,                     
     1   FOR_DOUBLE, CHARSTRING)                                      
      PRINT *,  'RETURNED FROM C++ FUNCTION'
      IF (J /= 999) THEN
         PRINT *, 'ERROR IN RETURN CODE FROM C++'                     
      ENDIF
      PRINT *, '***************************************'
      PRINT *, 'FORTRAN CALLING C++ EXAMPLE ENDED'    *
      PRINT *, '***************************************'
      END                                                             
 /*Module/File Name:  EDCCPFOR  */                                   
                                                                     
 extern "FORTRAN"                                                    
   { int CECFFOR (short &, int &, float &, double &, char * ) }      
 #include <stdio.h>                                                  
 #include <string.h>
 #include <math.h>
  /*************************************************************
   * This is an example of a C++ function invoked by a         *
   * Fortran program.                                          *
   * CECFFOR is called from Fortran program CEFOR2CP with the  *
   * following list of arguments:                              *
   *  Fortran INTEGER*2      to C short                        *
   *  Fortran INTEGER*4      to C int                          *
   *  Fortran REAL*4         to C float                        *
   *  Fortran REAL*8         to C double                       *
   *  Fortran CHARACTER* 23  to C char                         *
   *************************************************************/
  int CECFFOR (short & c_short,                                      
               int  & c_int,
               float & c_float,
               double & c_double,
               char * c_character_string
               )                                                      
 {                                                                    
    int ret=999;    /* Fortran program expects 999 returned */        
    fprintf(stderr,"CECFFOR STARTED\n");
 /***********************************************************         
  * Compare each passed argument against the C value.       *
  * Issue an error message for any incorrectly passed       *
  * parameter.                                              *
  ***********************************************************/        
    if (c_short != 15)                                                
    {                                                                 
      fprintf(stderr,"c_short not = 15\n");
      --ret;                                                          
    }                                                                 
                                                                      
    if (c_int != 31)                                                  
    {                                                                 
      fprintf(stderr,"c_int not = 31\n");
      --ret;                                                          
    }                                                                   
                                                                        
    if (fabs(53.99999 - c_float) > 1.0E-5F)                             
    {                                                                   
      fprintf(stderr,                                                   
           "fabs(53.99999 - c_float) > 1.0E-5F, %f\n", c_float);
      --ret;                                                            
    }                                                                   
                                                                        
    if (fabs(3.14159265358979312 - c_double) > 1.0E-13)                 
    {                                                                   
      fprintf(stderr,                                                   
           "fabs(3.14159265358979312 - c_double) > 1.0E-13,             
            %f.14\n",c_double);
      --ret;                                                            
    }  if (memcmp(c_character_string,"PASSED CHARACTER STRING",23)         
               != 0)                                                    

    {                                                                   
      fprintf(stderr,"c_character_string not %s\n",
      "\"PASSED CHARACTER STRING\"");
      --ret;                                                            
    }                                                                   
   /****************************************************************
   * Fortran program will check for a correct return code.        *
   ****************************************************************/
      fprintf(stderr,"CECFFOR ENDED\n");
      return(ret);                                                  
  }