//------------------------------------------------------------------- // link2asm.cpp // // Here is a simple exercise in "mixed language" programming // in which this C++ program calls an external function that // was written in assembly language. // // compile using: $ g++ link2asm.cpp myplus.o -o link2asm // // programmer: ALLAN CRUSE // date begun: 09 OCT 2003 //------------------------------------------------------------------- #include // for printf() // must provide the prototype for our external function extern "C" int myplus( int, int ); int main( int argc, char **argv ) { int x = 6, y = 7, z = myplus( 6, 7 ); printf( "\nok, %d plus %d equals %d \n\n", x, y, z ); }