http://quantlib.414.s1.nabble.com/Issues-with-C-CLI-wrappers-and-local-static-variables-in-quantlib-tp189p192.html
yes, we might possibly park them somewhere for review. If you're
> Hi Luigi,
>
> In the end I had to make changes to singleton.hpp and all the currency
> classes in america.hpp, africa.hpp, asia.hpp, europe.hpp and oceania.hpp.
> The currency classes also required the addition of a null deleter on the
> boost::shared_ptr declaration to overcome the CLR shutdown issues.
>
> It may be good just to park the code in a new folder along with a readme,
> rather than merge/test the changes into the existing codebase?
>
> Simon.
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:
[hidden email]]
> Sent: 24 August 2012 10:28
> To: Simon Shakeshaft
> Cc:
[hidden email]
> Subject: Re: [Quantlib-users] Issues with C++/CLI wrappers and local static
> variables in quantlib
>
> Hi Simon,
> we moved the instance to the local scope because we had problems with
> other compilers, but this might not be relevant anymore. If you post a
> patch, I'll be happy to try it.
>
> Luigi
>
> On Mon, Aug 6, 2012 at 10:42 AM, Simon Shakeshaft
> <
[hidden email]> wrote:
>> Hi,
>>
>>
>> I've been looking at building some C++/CLI wrappers around the
>> library, partially as an exercise to become more familiar with CLI
>> programming and partially to compare the approach with SWIG.
>>
>>
>>
>> However, I've run into a issue which may be a compiler issue but
>> Microsoft have it closed as 'Won't Fix'. The issue manifested it first
>> in the Singleton [patterns] class, as I was trying to migrate the FRA
>> example across to C#, using some of the wrapped classes I already had.
>> In the Singleton class the instance() method declares a static
>> variable of a native type with a destructor.
>>
>>
>>
>> However the compiler registers a managed destructor with atexit and
>> when the assembly is unloaded the CLR is already shut down, and an
>> attempt to transition back to managed code results in an exception
>> which cannot be caught.
>> e.g.
>> First-chance exception at 0x76a2b9bc in app.exe: 0xC0020001: The
>> string binding is invalid.
>> Unhandled exception at 0x76a2b9bc in app.exe: 0xC0020001: The string
>> binding is invalid.
>>
>>
>>
>> The case on Microsoft Connect is here:
>>
>>
https://connect.microsoft.com/VisualStudio/feedback/details/336844/sta>> tic-variable-in-native-method-causes-exception-c0020001-during-process
>> -exit
>>
>>
>>
>> The exception generates the annoying '... .exe has encountered a
>> problem and needs to close' dialog. This can be worked around by the
>> use of the SetErrorMode(), prior to exit, however the exception is
>> just masked at this point and the exit is not clean.
>>
>>
>>
>>
>> It's possible to move the local static variable in the Singleton class
>> to the class level as a private member, and I've done this on my
>> working copy - that works fine, the exit is now clean. However
>> similar code exists in many of the QuantLib classes - the specific
> currency classes are a case in point.
>>
>>
>>
>>
>> I'd be quite happy to work through the classes and pass the changes
>> across, if this would be useful, otherwise I can work around by using
>> SetErrorMode() etc.
>>
>> Best Regards
>> Simon
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond.
>> Discussions will include endpoint security, mobile security and the
>> latest in malware threats.
>>
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/>> _______________________________________________
>> QuantLib-users mailing list
>>
[hidden email]
>>
https://lists.sourceforge.net/lists/listinfo/quantlib-users>>
Everyone hates slow websites. So do we.