/*---------------------------------------------------------------------+ | Copyright (c) 1995, SAS Institute Inc. | | Unpublished - All Rights Reserved | | S A S / C S A M P L E | | | | | | NAME: CXXTOC2 | | 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(CXXTOC). | | 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(CXXTOC). | | 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 CXXTOC. | | NOTES: | | MISC NOTES: This example consists of 2 modules. CXXTOC1 is the C | | source module. CXXTOC2 is the C++ source module. | | | +---------------------------------------------------------------------*/ #include <stdio.h> void cnext(); extern void callc(); /* the C function called from C++ */ extern gotoc() /* the C++ function called from C */ { printf("This is C function gotoc()\n"); printf("Call another C function\n"); cnext(); printf("Returning to C++ main()\n"); return 0; } void cnext() /* another C function */ { printf("This is C function cnext()\n"); printf("Call a C++ function from C\n"); callcxx(); printf("Back in C function cnext()\n"); }