| 
   Slide 14.7: Linking to C/C++ (cont.) Slide 14.9: Calling C/C++ functions (cont.) Home  | 
  
    
   | 
 
main( ) procedure to allow library initialization code to run.
"C" and extern keywords.
Here is the basic syntax:
extern "C" funName( paramlist ) { ... }Here is an example:
extern "C" int askForInteger( ) { cout << "Please enter an integer:"; // ... }Rather than modifying every function definition, it's easier to group multiple function prototypes inside a block. Then you can omit
extern and "C" from the function implementations:
extern "C" { int askForInteger( ); int showInt( int value, unsigned outWidth ); etc. }