.dll problem

R

Raj Sood

i have a really simple function that calls a dll. the weird thing is
that it won't work if i just calc it in excel, but if i step into the
program and debug it... i can get it to work. of course when i mouse
over the variable that i use that passes the answer... it will say
<division by zero> then i mouse off of it and mouse over it again and
suddenly it gives me a number instead of <division by zero>... it's
really strange. at first i thought it was b/c i had the .dll on a
shared drive and possibly it was taking too long for it to get what it
needed from there... but i moved it to my c: drive... still the same
problem... any ideas what the problem is or how to fix??? please help!

(code below)
******************************************************************************

Function aimCreditDefaultSwapUpfrontPrem(ByVal cdsSpread As Double,
ByVal spot As Double, ByVal equityVol As Double, ByVal referenceSpot
As Double, ByVal riskFreeZeroRate As Double, ByVal bondRecoveryRate As
Double, ByVal years As Double, ByVal lambdaBarrierVol As Double, ByVal
continuousStockBorrowRate As Double, ByVal continuousCouponRate As
Double, ByVal resultTolerance As Double) As Double
Dim output As Double
Dim ok As Boolean

output = 0
ok = dll_aimCreditDefaultSwapUpfrontPrem(cdsSpread, spot,
equityVol, referenceSpot, riskFreeZeroRate, bondRecoveryRate, years,
lambdaBarrierVol, continuousStockBorrowRate, continuousCouponRate,
resultTolerance, output)

If ok = False Then
output = Sqr(-1)
End If

aimCreditDefaultSwapUpfrontPrem = output
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top