Jul 6, 2014 at 3:03 PM
Edited Jul 6, 2014 at 3:16 PM

I am trying to use some default values to my function. I know that someone posted earlier that a way to handle default arguments is to assume a LPOPER type.
However, I also noticed that in file args.h there is a member function
template<class T> XArgs& Arg(xcstr type, xcstr name, xcstr help, const T& t)
which assumes that it assigns a default value t to its argument,
Let's say I want to redesign the xll.sqrt function and assume the default input value is one if a user doesn't specify an argument value.
I tried to use
static AddInX xai_sqrt(
FunctionX(XLL_LPXLOPERX, _T("?xll_sqrt"), _T("XLL.SQRT"))
.Arg<double> (XLL_DOUBLEX, _T("num"), _T(" "), 1.0)
.Category(CATEGORY)
.FunctionHelp(_T(" "))
.Documentation(_T(" "))
)
and keep the same xll_sqrt routine.
In excel sheet, XLL.SQRT(4) returns 2. But XLL.SQRT() returns 0.
I am very new to this XLL programming. My question is how I can use above AddinX to make XLL.SQRT() take default value 1.
Thanks,
