Call an add-in function directly, and store the result
void CallAddin( CXlOper* pxloResult ); |
The return value of an add-in function.
This function can be used to call an add-in function directly from another add-in function within the same library. The result of the call will be placed in the calling CXlOper instance.
For example:
CXlOper* BsTheta_Impl(CXlOper& xloResult, double Spot, BOOL Put, const CXlOper*
Div, double Borrow, double ImpVol, double Strike, long ValueDate, long
Maturity, double RiskFree, short int DayCount)
{
// End of generated code
//}}XLP_SRC
// Call the array version of the function
CXlOper xloCalc;
xloCalc.CallAddin(BsCalc_Impl(xloCalc, Spot, Put, Div, Borrow, ImpVol,
Strike, ValueDate, Maturity, RiskFree, DayCount));
// Extract a cell from the array
if (xloCalc.IsArray())
xloResult = xloCalc.Cell(6, 1);
else
xloResult = xloCalc;
return xloResult.Ret();
}
See the SimpOpt sample for an example of the method in use.
This is the recommended way to call local add-in functions directly. Any other method (such as simply copying the return value) may result in memory leaks.
Header: xllplus.h
CXlOper Class | CXlOper Methods | CXlOper::Ret() | CXlOper::Excel()