Hi Luigi,

Sorry for the delayed response...

As you note the calendar classes did not give a problem when wrapped, so following on from that I have moved the implementation into cpp files for the currency classes and tested against test cases I had, which previously failed.

That all seems ok and I'm just tidying up and testing against the existing QuantLib test suite.

Additionally I've moved the templated Singleton instance() method to a cpp file and then explicitly instantiated the various Singleton specializations so they can be linked. 

The disadvantage of this is obviously the explicit instantiations that need to be maintained in the cpp file.  On the other hand the dependency issues when making changes to the Singleton implementation go away (and these were pretty extensive!).  Also I am more happy that this retains the initialisation on first use idiom for static variables, which I think is to be preferred.

When I'm happy with what I have I'll update my repo and send another pull request across.

Cheers
Simon
Sent using BlackBerry® from Orange

-----Original Message-----
From: Luigi Ballabio <notifications@github.com>
Date: Thu, 10 Oct 2013 06:39:46 
To: lballabio/quantlib<quantlib@noreply.github.com>
Reply-To: lballabio/quantlib <reply@reply.github.com>
Cc: simonshakeshaft<simon.shakeshaft@estrategy-solutions.com>
Subject: Re: [quantlib] C++/CLI wrappers and local static variables in
 Quantlib (#41)

> +                                         Rounding(),
> +                                         "%3% %1$.2f");
> +
> +    Currency::Data USDCurrency::usdData_("U.S. dollar", "USD", 840,
> +                                        "$", "\xA2", 100,
> +                                        Rounding(),
> +                                        "%3% %1$.2f");
> +
> +    Currency::Data VEBCurrency::vebData_("Venezuelan bolivar", "VEB", 862,
> +                                         "Bs", "", 100,
> +                                         Rounding(),
> +                                         "%3% %1$.2f");
> +
> +    ARSCurrency::ARSCurrency() {
> +        data_ = boost::shared_ptr<Currency::Data>(&arsData_, null_deleter());
> +    }

Instead of using static data, would the CLI compilation work if we just moved the existing constructors to a .cpp file?  The exact same idiom doesn't seem to cause problems in the calendar classes, which also use static variables in constructors.  If this worked, we could unify the CLI and non-CLI implementations for currencies.
(The singleton would still need the change, since it's a template and can't go in a .cpp file.)

---
Reply to this email directly or view it on GitHub:
https://github.com/lballabio/quantlib/pull/41/files#r6886553