/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: C2FORTC                                                |
|   LANGUAGE: C                                                      |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A C MAIN CALLING A           |
|             FORTRAN ROUTINE.                                       |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             C2FORTC, C2FORTF, AND C2FORT.                          |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(C2FORT).                |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(C2FORT).                |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(C2FORT).                |
| TSO -                                                              |
|    COMPILE: FORTRAN - USE FORTRAN COMPILER.                        |
|             C - LC370C C2FORTC                                     |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(C2FORT).    |
|    EXECUTE: CALL .LOAD(C2FORT)                             |
| CMS -                                                              |
|    COMPILE: FORTRAN - USE FORTRAN COMPILER.                        |
|             C - LC370 C2FORTC                                      |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(C2FORT).   |
|     EXECUTE: CALL C2FORT                                           |
| 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
     {
     printf("before calling forpgm\n");
     forpgm();
     printf("after calling forpgm\n");
     if (dlfmwk(token))
        exit(8);
     else
        exit(0);
     }

 return 1;
}