I'm working on a managed c++/cli wrapper for QuantLib that I can use it with
.net code. I'm using VS 2010 and have the latest code, where I downloaded the 2010 project using the advice from Quantcorner. I've built the QuantLib code (with no problems) and included the library and headers in the managed project as a reference. The code compiles, but I'm getting linking errors that all seem to be centered around the FDM Heston code. There are 12 linking errors in total; including three example errors for reference. Hopefully someone will tell me what's going on: Error 1 error LNK2019: unresolved external symbol "public: __thiscall QuantLib::FdmSimpleProcess1dMesher::FdmSimpleProcess1dMesher(unsigned int,class boost::shared_ptr<class QuantLib::StochasticProcess1D> const &,double,unsigned int,double)" (??0FdmSimpleProcess1dMesher@QuantLib@@QAE@IABV?$shared_ptr @VStochasticProcess1D@QuantLib@@@boost@@NIN@Z) referenced in function "public: virtual void __thiscall QuantLib::FdHestonHullWhiteVanillaEngine::calculate(void)const " (?calculate@FdHestonHullWhiteVanillaEngine@QuantLib@@UBEXXZ) Error 2 error LNK2019: unresolved external symbol "public: __thiscall QuantLib::Fdm3DimSolver::Fdm3DimSolver(struct QuantLib::FdmSolverDesc const &,struct QuantLib::FdmSchemeDesc const &,class boost::shared_ptr<class QuantLib::FdmLinearOpComposite> const &)" (??0Fdm3DimSolver@QuantLib@@QAE@ABUFdmSolverDesc@1@ABUFdmSchemeDesc @1@ABV?$shared_ptr@VFdmLinearOpComposite@QuantLib@@@boost@@@Z) referenced in function "protected: virtual void __thiscall QuantLib::FdmHestonHullWhiteSolver::performCalculations(void)const " (?performCalculations@FdmHestonHullWhiteSolver@QuantLib@@MBEXXZ) Error 12 error LNK2019: unresolved external symbol "public: double __thiscall QuantLib::Fdm2DimSolver::thetaAt(double,double)const " (?thetaAt@Fdm2DimSolver@QuantLib@@QBENNN@Z) referenced in function "public: double __thiscall QuantLib::FdmHestonSolver::thetaAt(double,double)const " (?thetaAt@FdmHestonSolver@QuantLib@@QBENNN@Z) ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
To add more color, I'm testing a simple option pricer, using the EquityOption
example. I've done some more testing. I can get an American option to build and link, but I can't get a European option to link. See code below. If I uncomment the European section then I can't get the code to link. void priceOptionEuro( Date valueDate, Date settlementDate, Date maturity, Real underlying, Real strike, Rate riskFreeRate, Spread dividendYield, Volatility volatility, double &NPV) { // Hard-coded values for now Calendar calendar = TARGET(); DayCounter dayCounter = Actual365Fixed(); Option::Type type(Option::Call); // Exercise type Handle<Quote> underlyingH( boost::shared_ptr<Quote>(new SimpleQuote(underlying))); // bootstrap the yield/dividend/vol curves // Flat yield structure Handle<YieldTermStructure> flatTermStructure( boost::shared_ptr<YieldTermStructure>( new FlatForward(settlementDate, riskFreeRate, dayCounter))); // Flat dividend Handle<YieldTermStructure> flatDividendTS( boost::shared_ptr<YieldTermStructure>( new FlatForward(settlementDate, dividendYield, dayCounter))); // Flat vol Handle<BlackVolTermStructure> flatVolTS( boost::shared_ptr<BlackVolTermStructure>( new BlackConstantVol(settlementDate, calendar, volatility, dayCounter))); boost::shared_ptr<StrikedTypePayoff> payoff( new PlainVanillaPayoff(type, strike)); Size timeSteps = 801; // BSM process boost::shared_ptr<BlackScholesMertonProcess> bsmProcess( new BlackScholesMertonProcess(underlyingH, flatDividendTS, flatTermStructure, flatVolTS)); // European code that gives linking problem /*boost::shared_ptr<Exercise> europeanExercise( new EuropeanExercise(maturity)); VanillaOption europeanOption(payoff, europeanExercise); europeanOption.setPricingEngine(boost::shared_ptr<PricingEngine>( new FDEuropeanEngine<CrankNicolson>(bsmProcess, timeSteps, timeSteps-1))); NPV = europeanOption.NPV();*/ // American code that builds and links boost::shared_ptr<Exercise> americanExercise( new AmericanExercise(settlementDate, maturity)); VanillaOption americanOption(payoff, americanExercise); americanOption.setPricingEngine(boost::shared_ptr<PricingEngine>( new FDAmericanEngine<CrankNicolson>(bsmProcess, timeSteps, timeSteps-1))); NPV = americanOption.NPV(); } ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by John Maiden
I can also swap out the American code with a Bermudan one-exercise, which also
builds and links: std::vector<Date> exerciseDates; exerciseDates.push_back(maturity); boost::shared_ptr<Exercise> bermudanExercise( new BermudanExercise(exerciseDates)); VanillaOption bermudanOption(payoff, bermudanExercise); bermudanOption.setPricingEngine(boost::shared_ptr<PricingEngine>( new FDBermudanEngine<CrankNicolson>(bsmProcess, timeSteps, timeSteps-1))); NPV = bermudanOption.NPV(); ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by John Maiden
Actually, I'm getting the Bermudan and American code to link, but I'm getting
runtime errors. It happens when FDBermudanEngine/FDAmericanEngine get to their base class, FDVanillaEngine. The base class tries to initiate the TridiagonalOperator member with size = 0, which ends up copying an empty array. This gets caught as an error when copy is called for a null array. ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Mon, 2011-04-04 at 03:25 +0000, John Maiden wrote:
> Actually, I'm getting the Bermudan and American code to link, but I'm getting > runtime errors. It happens when FDBermudanEngine/FDAmericanEngine get to their > base class, FDVanillaEngine. The base class tries to initiate the > TridiagonalOperator member with size = 0, which ends up copying an empty array. > This gets caught as an error when copy is called for a null array. Yes, this was fixed recently on the 1.1 branch, but we haven't released it yet. You can check it out from Subversion. The name of the branch is R01010x-branch. Luigi -- Discontent is the first necessity of progress. -- Thomas A. Edison ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Fri, 2011-04-08 at 17:35 +0200, Luigi Ballabio wrote:
> On Mon, 2011-04-04 at 03:25 +0000, John Maiden wrote: > > Actually, I'm getting the Bermudan and American code to link, but I'm getting > > runtime errors. It happens when FDBermudanEngine/FDAmericanEngine get to their > > base class, FDVanillaEngine. The base class tries to initiate the > > TridiagonalOperator member with size = 0, which ends up copying an empty array. > > This gets caught as an error when copy is called for a null array. > > Yes, this was fixed recently on the 1.1 branch, but we haven't released > it yet. You can check it out from Subversion. The name of the branch > is R01010x-branch. Checking out the branch might fix the linking errors, too---the projects on the trunk might not be fully updated. Luigi -- Though this be madness, yet there is method in't. -- Hamlet, Act II, scene II ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |