/*-------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                    S A S / C   S A M P L E                         |
|                                                                    |
|       NAME: CXPASCPC                                               |
|   LANGUAGE: C++                                                    |
|    PURPOSE: THIS EXAMPLE DEMONSTRATES A PASCAL PROGRAM CALLING     |
|             A C++ FUNCTION, PASSING A PARAMETER LIST.              |
|             IT CONSISTS OF SAMPLE LIBRARY MEMBERS                  |
|             CXPASCPC, CXPASCPP, AND CXPASCPM.                      |
| MVS -                                                              |
|    COMPILE: USE JCL PROVIDED IN SAMPLE.AUX(CXPASCPM).              |
|       LINK: USE JCL PROVIDED IN SAMPLE.AUX(CXPASCPM).              |
|    EXECUTE: USE JCL PROVIDED IN SAMPLE.AUX(CXPASCPM).              |
| TSO -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LCXX  CXPASCPC                                     |
|       LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(CXPASCPM).  |
|    EXECUTE: CALL .LOAD(CXPASCPM)                           |
| CMS -                                                              |
|    COMPILE: PASCAL - USE PASCAL COMPILER.                          |
|             C - LCXX  CXPASCPC                                     |
|        LINK: ILCLINK, USING CONTROL CARDS IN SAMPLE.AUX(CXPASCPM). |
|     EXECUTE: CALL CXPASCPM                                         |
|   MISC NOTES: THE FOLLOWING LSCL1028 MESSAGES CAN BE IGNORED:      |
|     THE FILE "SYSLIB(AMPXRETC)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXHALT)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXSEGE)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXSTRT)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(AMPXPARM)" COULD NOT BE OPENED FOR AUTOCALL.  |
|     THE FILE "SYSLIB(PASCPROC)" COULD NOT BE OPENED FOR AUTOCALL.  |
+-------------------------------------------------------------------*/
#include 
#include 
#include 

__pascal void pascproc();

void main()
  {
   struct string
     {
     short len;
     char text(|30|);
     };
   struct string pascparm = { 0, "Hello from PASCAL" };
   void *token;

   pascparm.len = strlen(pascparm.text);
   cout << "Hello, from the C++ program!" << endl;
   token = mkfmwk("PASCAL","");
   if (!token)
    {
     cout << "Can't create the Pascal framework!" << endl;
     exit(12);
    }
   cout << "Hello World C++ calling PASCAL" << endl;
   pascproc(pascparm);
   cout << "Successful return from PASCAL" << endl;
   dlfmwk(token);
  }