I am using VS C++ 2008
the code in C++:
#define TESTOMMANDS __declspec ( dllexport )
TESTOMMANDS int Add_Two_Numbers(int n1,int n2)
{
return n1 + n2;
}
TESTOMMANDS int Add_Three_Numbers(int n1,int n2, int n3)
{
return n1 + n2 + n3;
}
TESTOMMANDS DWORD Add_Two_Floats(float f1,float f2)
{
float sumf = f1 + f2;
return *(DWORD*)&sumf;
}
String Table:
ADD TWO NUMBERS[%LLL%?Add_Two_Numbers@@YAHHH@Z
ADD THREE NUMBERS[%LLLL%?Add_Three_Numbers@@YAHHHH@Z
ADD TWO FLOATS[%DFF%?Add_Two_Floats@@YAKMM@Z
DBP code:
print "start test"
wait key
a = add two numbers(10,5)
print str$(a)
wait key
b = add three numbers(10,5,5)
print str$(b)
wait key
r# = add two floats(1.5,2.6)
print str$(r#)
wait key
Output:
start test
15
20
1082340096
as you can see the float should be 4.1
but it's returned 1082340096
what Iam doing wrong?