Posted by
Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Settings-instance-evaluationDate-produces-exception-in-managed-code-tp7848p7851.html
On Tue, 2009-09-22 at 14:25 -0400, Boris Skorodumov wrote:
> This is what I see. As long as in unmanaged code i have implementation
> of function test (which call Settings::instance().evaluationDate())
> inside of the class TestSettings or as inline function in the same hpp
> file - no problems. it works with current singleton.hpp
> implementation. If I have implementation of test in separated cpp file
> then exeption occures. It occurs in either way with commented line 70
> and substituted by #if defined(QL_PATCH_MSVC) or as it is right now
> in singleton.hpp.
Wait, I didn't quite get the last part. With the code as it is now, it
doesn't work in either way. For it to work, you have to comment out the
"inline" on line 70. Is this correct?
Also: what happens if you define an inline function in a hpp file that
calls Settings::instance().evaluationDate(), and then you implement the
"test" function in a separate cpp and make it call the new function?
Something like:
-----
inline void setDate(const Date& d) { // in hpp file
Settings::instance().evaluationDate() = d;
}
-----
void TestSettings::test() // in separate cpp file
{
Date todaysDate = Date::todaysDate();
setDate(todaysDate);
}
--
Olmstead's Law:
After all is said and done, a hell of a lot more is said
than done.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users