register an Excel add-in function from quantlibXL

Posted by Neil Chang on
URL: http://quantlib.414.s1.nabble.com/register-an-Excel-add-in-function-from-quantlibXL-tp14862.html

Hi there,
  I am trying to create an add-in function for Excel using quantlibXL, somehow I stuck with register. I did what I show below, and I can see my function in Excel's worksheet, however, when I calls it with proper inputs, it always return '#VALUE!' to me.
I don't quite understand what I did wrong. I suspect it's the "parameter codes" in the register. However, I don't know what's the meaning of the
"\x14" or "CCCEEEEPP#"? I just guessed by looking at other codes, the first one looks like the length of the string, not sure what does the second one mean?

I searched but couldn't find anything related, anyone knows any reference?
or has experience with getting "#VALUE!" from your own add-in function?

Thanks,
Here's my code in register_options.cpp:

Excel(xlfRegister, 0, 18, &xDll,
            // function code name
            TempStrNoSize("\x1C""qlImpliedVolatility"),
            // parameter codes
            TempStrNoSize("\x14""CCCEEEEPP#"),
            // function display name
            TempStrNoSize("\x1C""qlImpliedVolatility"),
            // comma-delimited list of parameter names
            TempStrNoSize("\x4F""ObjectId,ProcessID,targetPrice,accuracy,maxEval, minVol, maxVol, Trigger"),
            // function type (0 = hidden, 1 = worksheet)
            TempStrNoSize("\x01""0"),
            // function category
            TempStrNoSize("\x14""QuantLib - Financial"),
            // shortcut text (command macros only)
            TempStrNoSize("\x00"""),
            // path to help file
            TempStrNoSize("\x00"""),
            // function description
            TempStrNoSize("\x49""Implied volatility of an option"),
            // parameter descriptions
            TempStrNoSize("\x3A""id of existing QuantLib::VanillaOption object"),
            TempStrNoSize("\x4F""id of existing QuantLib::GeneralizedBlackScholesProcess object."),
            TempStrNoSize("\x1A""Target Price."),
            TempStrNoSize("\x1C""Accuracy"),
            TempStrNoSize("\x23""maximum num of evaluations"),
            TempStrNoSize("\x1D""minimum volatility"),
            TempStrNoSize("\x1B""max volatility."),
            TempStrNoSize("\x1D""dependency tracking trigger."));

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users