Re: build dll from QuantlibExcel

Posted by Xavier.Abulker on
URL: http://quantlib.414.s1.nabble.com/build-dll-from-QuantlibExcel-tp3303p3305.html


Hi Eric,
thank you very much for your answer.
I did something different, I've redefined the class with something like:

 double _stdcall vbainterpolate2D(double * x_tab, int sizex, double * y_tab, int sizey, double * z_tab, double x,  double y, int vbainterpolation2DType, int vbaallowExtrapolation)
{......
   double result = interpolate2D(y_value, x_value, data_matrix,
            yinterpolation, xinterpolation, vbainterpolation2DType,
             allowExtrapolation);
  return result;
}
and I've added a new file .def with:

; MFCDLLSample.def: Declares
LIBRARY "testxab.dll"
DESCRIPTION 'TEST XAB WIN32 dll'

EXPORTS
vbainterpolate2D @1

It works fine with that but as you said I need to rewrite everthing. I will go step by step with the functions I need.

However your solution looks better, if it's just a replacement of XlfFuncDesc with XlfCmdDesc it won't be so long.

I will study this solution in detail and thank you gain for your help
Xavier



eric <[hidden email]>

22/09/2004 22:02

       
        To:        [hidden email]
        cc:        [hidden email], [hidden email]
        Subject:        Re: [Quantlib-users] build dll from QuantlibExcel



Hi Xavier

I've done some investigating regarding the attached message that you
sent a couple of weeks back.  Unfortunately I don't think it's possible
to do what you ask.

An XLL is just a special case of a DLL and can in theory be invoked from
a VB program.  However, all of the inputs and outputs to the QuantLibXL
functions are of the special Excel datatype XLOPER, and there is no
mechanism to translate XLOPERs to/from VB datatypes.

Excel VBA does support automatic translation of XLOPERS to/from VB(A)
datatypes.  However, all of the QuantLibXL functions are implemented as
cell formulas.  In order for the functions to be callable from VBA
they'd have to be declared instead as VBA functions, this would mean
editing the QuantLibXL source code and replacing all occurrences of XLW
class XlfFuncDesc with XlfCmdDesc, not a small task.

Regards
Eric

On Thu, 2004-09-02 at 11:34, [hidden email] wrote:
> Nando,
> I'd like to use the QuantlibExcel in Visual Basic and I need to
> generate a dll file from your QuantLibXL instead of a lib file.
> Do you know if there's an easy way to do that?
> Thank you
> Xavier