/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: CXXFORTC                                               |
|   LANGUAGE: C++                                                    |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A C++ MAIN CALLING A         |
|             FORTRAN ROUTINE.                                       |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             CXXFORTC, CXXFORTF, AND CXXFORT.                       |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(CXXFORT).               |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(CXXFORT).               |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(CXXFORT).               |
| TSO -                                                              |
|    COMPILE: FORTRAN - USE FORTRAN COMPILER.                        |
|             C++ - LCXX  CXXFORTC                                   |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(CXXFORT).   |
|    EXECUTE: CALL .LOAD(CXXFORT)                            |
| CMS -                                                              |
|    COMPILE: FORTRAN - USE FORTRAN COMPILER.                        |
|             C++ - LCXX CXXFORTC                                    |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(CXXFORT).  |
|     EXECUTE: CALL CXXFORT                                          |
| MISC NOTES: THE FOLLOWING LSCL102 MESSAGES CAN BE IGNORED:         |
| WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(IFYVINTE)     |
| WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(VFEE#)        |
| WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(VFES#)        |
| WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(VFEIM#)       |
| WARNING: CAN'T OPEN FILE DURING AUTOCALL: DDN:SYSLIB(FORPGM)       |
+-------------------------------------------------------------------*/
#include 
#include 
#include 
#include 
#include 

main()
{

   void *token;
   extern __fortran void forpgm();

   if(!(token = mkfmwk("fortran","")))
     exit(16);

   else
     {
     cout << "before calling forpgm" << endl;
     forpgm();
     cout << "after calling forpgm" << endl;
     if (dlfmwk(token))
        exit(8);
     else
        exit(0);
     }

 return 1;
}