Hello All
I have written a cpp functiion and am using the dll function ( I have checked for name decoration etc) in a VBA code
The Declaration of the function is
extern "C" double DLLEXPORT __stdcall vgDelta(double stockprice,double strikeprice,double sigma,double VGtheta,double nu,double tenor,double riskfreerate);
and the export with name decoration correction is
EXPORTS
vgDelta = _vgDelta@56
using it in macro with import in this fashion :
Declare Function vgDelta Lib "test.dll" (ByVal stockprice As Double, ByVal strikeprice As Double, ByVal sigma As Double, ByVal VGtheta As Double, ByVal nu As Double, ByVal tenor As Double, ByVal riskfreerate As Double) As Double
Function test() As Double
Dim abc As Double
abc = vgDelta(1742, 1742, 0.175639616, -0.071753491, 0.132, 0.986, 0.00001)
test = abc
End Function
I have debugged the code the values of arguments are passed correctly and the return value is also calculated correctly but the VBA code says
Run-time error "11"
"Division by zero"
Where could i be going wrong?, please help ...
Thanx in advance
Manik
Ps: Using unmanaged cpp vs 2005 and excel 2003
Bookmarks