I need to call PrintResult from my assembly to display the result. I know I have to use extrn _PrintResult somewhere, and I should call the function using call _PrintResult but I'm not sure quite sure how to use it. any suggestions
public _Square
.386
.model flat
.code
_Square proc
mov eax, [esp+4]
imul eax
ret
_Square endp
.............Here is my C++ code.........
#include <iostream>
using namespace std;
enum ResultCode {ShowSquare};
enum SuccessCode {Failure, Success};
extern "C" long Square (long);
void main ()
{
long Num1;
long Num2;
do
{
cout << "Enter Number to Square" << endl;
cin >> Num1;
Result = Square (Num1);
cout << "Square is: " << Result << endl;
} while (Result > 0);
}
void PrintResult (ResultCode PrintCode, long Value) //PrintCode, long Value)
{
switch (PrintCode)
{
case ShowSquare:
cout << "Display of square is: " << Value << endl;
break;
default:
cout << "Error in assembly routines" << endl;
}
}