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 |
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 |
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
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 |
On Thu, 2004-09-23 at 11:06, [hidden email] wrote:
> Hi Eric, > thank you very much for your answer. Hi Xavier, Happy to help. > I did something different, I've redefined the class with something > like: > > double _stdcall vbainterpolate2D(double * x_tab, int sizex, double * Perfect. That gets around the problem of translating XLOPERs. > However your solution looks better, if it's just a replacement of > XlfFuncDesc with XlfCmdDescit won't be so long. As far as I can determine, this approach is viable. As I'm sure you know, you'd load the XLL as normal, and invoke it from VBA with retval = Application.Run("function_name", arg1, arg2, ..., argn) The arguments could be any VBA datatype and Excel would automatically convert them (where valid) to the corresponding XLOPERs. A limitation of this approach, it could only be used with Excel VBA, not pure VB. > I will study this solution in detail and thank you gain for your help > Xavier I'm very curious to hear how you get on - please keep us posted. If you and/or others have an ongoing requirement for invoking QuantLib from VB / Excel VBA then I think an argument could be made for implementing a permanent solution to this and I'd be happy to assist. Many Thanks, Eric |
In reply to this post by Xavier.Abulker
You don't have to declare anything. All you need to do is to do:
Application.run("quantlibxl function name", list of arguments) Return type should be var. -----Original Message----- From: eric [mailto:[hidden email]] Sent: Wednesday, September 22, 2004 3:03 PM 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 ------------------------------------------------------- This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 Project Admins to receive an Apple iPod Mini FREE for your judgement on who ports your project to Linux PPC the best. Sponsored by IBM. Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by erik-44
Eric and Xavier,
I am interested in a permanent excel or openoffice link. I teach at the univeristy of tulsa and require my students to purchase Espen Haug's book The complete option guided because I converted the formulaes in that book to an excel addin. Quantlib would be a nice replacement. Also, FEA and Techhackers proprietary financial functions that quantlib could replace in many instances if there was an excel addin so people could see what quantlib does and utilize quantlib dll's in their production models. Just a thought Joe --- eric <[hidden email]> wrote: > On Thu, 2004-09-23 at 11:06, > [hidden email] wrote: > > Hi Eric, > > thank you very much for your answer. > > Hi Xavier, > Happy to help. > > > I did something different, I've redefined the > class with something > > like: > > > > double _stdcall vbainterpolate2D(double * x_tab, > int sizex, double * > > Perfect. That gets around the problem of > translating XLOPERs. > > > However your solution looks better, if it's just a > replacement of > > XlfFuncDesc with XlfCmdDescit won't be so long. > > As far as I can determine, this approach is viable. > As I'm sure you > know, you'd load the XLL as normal, and invoke it > from VBA with > > retval = Application.Run("function_name", arg1, > arg2, ..., argn) > > The arguments could be any VBA datatype and Excel > would automatically > convert them (where valid) to the corresponding > XLOPERs. > > A limitation of this approach, it could only be used > with Excel VBA, not > pure VB. > > > I will study this solution in detail and thank you > gain for your help > > Xavier > > I'm very curious to hear how you get on - please > keep us posted. If you > and/or others have an ongoing requirement for > invoking QuantLib from VB > / Excel VBA then I think an argument could be made > for implementing a > permanent solution to this and I'd be happy to > assist. > > Many Thanks, > Eric > > > > > This SF.Net email is sponsored by: YOU BE THE JUDGE. > Be one of 170 > Project Admins to receive an Apple iPod Mini FREE > for your judgement on > who ports your project to Linux PPC the best. > Sponsored by IBM. > Deadline: Sept. 24. Go here: > http://sf.net/ppc_contest.php > _______________________________________________ > Quantlib-users mailing list > [hidden email] > > ===== A man is not the center of his universe, rather those he loves are. So his focus should always be on them for they will provide him with love and happiness all of his life - Anonymous __________________________________ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com |
Free forum by Nabble | Edit this page |