Posted by
Don Stewart-3 on
URL: http://quantlib.414.s1.nabble.com/Expose-a-QuantLib-class-method-to-QuantLibAddin-tp319p320.html
Hi there,
For the purpose of the discussion below I'm using Microsoft Visual C++
with the QuantLibXL__full_vc9 solution containing the QuantLibXLStatic
project. The overview of exposing a method is:-
1 - In qlgensrc, add a <Member> element to the objects .xml file.
2 - Rebuild qlgensrc project which auto generates/updates the necessary
files in QuantLibObjects and QuantLibXLStatic projects.
3 - Build the QuantLibObjects and QuantLibXLStatic (or rebuild the
solution).
As an example, lets say we wanted to expose the
QuantLib::CapFloor::capRates() method (its already exposed so take a
look at the files mentioned).
1 - Add to \QuantLibAddin\gensrc\metadata\functions\capfloor.xml the
element
<Member name='qlCapFloorCapRates' type='QuantLib::CapFloor'>
<description>Returns the cap rates for the given CapFloor
object.</description>
<libraryFunction>capRates</libraryFunction>
<SupportedPlatforms>
<SupportedPlatform name='Excel'/>
</SupportedPlatforms>
<ParameterList>
<Parameters/>
</ParameterList>
<ReturnValue>
<type>QuantLib::Rate</type>
<tensorRank>vector</tensorRank>
</ReturnValue>
</Member>
2 - Rebuild the qlgensrc project which updates
\QuantLibXL\qlxl/register/register_capfloor.cpp
\QuantLibXL\qlxl/functions/capfloor.cpp
\QuantLibXL\qlxl/functions/functioncount.hpp
\QuantLibAddin\Docs\auto.pages/volatility.docs
\QuantLibAddin\Docs\auto.pages/capfloor.doc
3 - Build QuantLibXLStatic
In this example no files were change in QuantLibObjects so there was no
need to build that project. If you are unsure then build the solution
and it will determine what projects need building.
Some things to keep in mind.
If your exposing activity results in qlgensrc creating files, make sure
you include those created files in their projects otherwise you will get
a link error.
If the method you are exposing requires any processing of what is
returned by the underlying QuantLib method call then add this processing
to \QuantLibAddin\qlo\xxx.cpp,hpp. For an example see qlBondDescription
in \QuantLibAddin\gensrc\metadata\functions\bond.xml and associated
description() method in \QuantLibAddin\qlo\bond.cpp,hpp
If you get compilation errors in QuantLibObjects/QuantLibXLStatic or
link errors in QuantLibXLStatic which you can't explain then I've found
the cause usually to be missing <include></include> file(s) in
\QuantLibAddin\gensrc\metadata\functions\xxx.xml.
>From a previous post (I didn't record which one) Andrew Downes sent the
attached documents which may be of some help when you get to a more
advance stage.
Regards Don Stewart
[hidden email]
________________________________
From: g m [mailto:
[hidden email]]
Sent: 29 June 2011 12:51
To:
[hidden email]
Subject: [Quantlib-users] Expose a QuantLib class method to
QuantLibAddin
Hi,
What is the key stages to expose a quantLib class method to
QuantlibAddin ?
Unfortunately in the Stock class used in the tutorial here =>
http://quantlib.org/quantlibaddin//extend_tutorial.html there is no
class method.
Many thanks.
This communication and any attachments contains information which is confidential and may be subject to legal privilege. It is for intended recipients only. If you are not the intended recipient you must not copy, distribute, publish, rely on or otherwise use it without our consent. Some of our communications may contain confidential information which it could be a criminal offence for you to disclose or use without authority. If you have received this email in error please notify
[hidden email] immediately and delete the email from your computer.
The FSA reserves the right to monitor all email communications for compliance with legal, regulatory and professional standards.
This email is not intended to nor should it be taken to create any legal relations or contractual relationships. This email has originated from
The Financial Services Authority (FSA)
25 The North Colonnade,
Canary Wharf,
London
E14 5HS
United Kingdom
Registered as a Limited Company in England and Wales No.1920623.
Registered Office as above
Switchboard: 020 7066 1000
Web Site:
http://www.fsa.gov.uk*****************************************************************
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
AndrewDownesExposeAdditionalQuantLibEnumerationsToQuantLibXL20101208.pdf (40K)
Download Attachment
AndrewDownesExposeAdditionalQuantLibTemplateClassesToQuantLibXL20101208.pdf (188K)
Download Attachment