Re: Tutorial to use ObjectHandler outside of QuantLibXL

Posted by Eric Ehlers-3 on
URL: http://quantlib.414.s1.nabble.com/Tutorial-to-use-ObjectHandler-outside-of-QuantLibXL-tp16776p16831.html

> I had done what you said, that is, instantiating the Repository
> singleton before calling its functions, during my first attempts...
> and this was the result:
>
> int main()
> {
> try
> {
> *ObjectHandler::Repository repository;*
> makeObject("Object1", "Foo");
>
> char tmp;
> std::cin >> tmp;
> return 0;
> }
> catch(...)
> {
> throw "Exception thrown!";
> return 1;
> }
> }

You definitely need to instantiate the repository, so whatever error
you got must be something else, let's see the message.  What happens if
you run this code?

#include <iostream>
#include <exception>

int main()
{
        try
        {
                ObjectHandler::Repository repository;
                makeObject("Object1", "Foo");
                return 0;
        }
        catch(const std::exception &e)
        {
                std::cout "Exception " << e.what() << std::endl;
                return 1;
        }
        catch(...)
        {
                std::cout "Exception" << std::endl;
                return 1;
        }
}

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users