/*---------------------------------------------------------------------+
|                Copyright (c) 1995, SAS Institute Inc.                |
|                  Unpublished - All Rights Reserved                   |
|                      S A S / C   S A M P L E                         |
|                                                                      |
|                                                                      |
|         NAME: CTOCXX2                                                |
|     LANGUAGE: C++                                                    |
|      PURPOSE: Call a C++ function from a C main(). Then, call a C    |
|               function from a C++ function.                          |
|   MVS -                                                              |
|      COMPILE: Compiled using LC370C for C, LCXX for C++.             |
|         LINK: Linked using LCXXL.                                    |
|      EXECUTE: Call <prefix>.LOAD(CTOCXX).                            |
|        NOTES:                                                        |
|   TSO -                                                              |
|      COMPILE: Compile using LC370C for C, LCXX for C++.              |
|         LINK: Link the C and C++ object modules using CLK370 with    |
|               "CXX" option.                                          |
|      EXECUTE: Call <prefix>.LOAD(CTOCXX).                            |
|        NOTES:                                                        |
|   CMS -                                                              |
|      COMPILE: Compile using LC370C for C, LCXX for C++.              |
|         LINK: Link the C and C++ object modules using CLINK with     |
|               "CXX" and "GENMOD" options.                            |
|      EXECUTE: Call CTOCXX.                                           |
|        NOTES:                                                        |
|   MISC NOTES: This example consists of 2 modules. CTOCXX1 is the C   |
|               source module. CTOCXX2 is the C++ source module.       |
|                                                                      |
+---------------------------------------------------------------------*/

#include <iostream.h>

void cxxnext();
extern "C" void callc();          /* the C function called from C++   */

extern "C" gotocxx()              /* the C++ function called from C   */
{
cout << "This is C++ function gotocxx()" << endl;
cout << "Call another C++ function" << endl;
cxxnext();
cout << "Returning to C main()" << endl;
return 0;
}

void cxxnext()                    /* another C++ function             */
{
cout << "This is C++ function cxxnext()" << endl;
cout << "Call a C function from C++" << endl;
callc();
cout << "Back in C++ function cxxnext()" << endl;
}