PureBytes Links
Trading Reference Links
|
I'm just started my journey into TS DLL coding and could use some
guidance with the following:
If I call the following c dll "BDAvg1" with the EasyLanguage statement:
print( BDAvg1(5.2, 6.4, 11.7) );
float FAR PASCAL BDAvg1(float price1, float price2, float price3)
{
float avg = 0;
avg = (price1 + price2 + price3)/3;
return avg;
}
It prints the expected value 7.77. This example if from SAMPLE1.ZIP
which is part of DLL.ZIP.
However when I do this:
float FAR PASCAL BDAvg1(float price1, float price2, float price3)
{
float avg = 0;
float x = 2.1f;
avg = (price1 + price2 + price3)/3;
return avg + x;
}
It still returns 7.77.
But if I do this:
float FAR PASCAL BDAvg1(float price1, float price2, float price3)
{
float avg = 0;
float x = 2;
avg = (price1 + price2 + price3)/3;
return avg + x;
}
It returns 9.77. Very strange. I've searched the Omega archives and
read several messages about problems returning floats (seems to related
to the Borland compiler). Here I've successfully passed in floats and
returned a float, but the problem seems to be related to local floats.
Any thoughts as to what's going on here would be greatly appreciated.
Using VC++v1.0;
thanks
Brian Dalby
|