|
Boost Users : |
Subject: Re: [Boost-users] C# application crashes due exception in exception_ptr.hpp
From: Damien (damien_at_[hidden])
Date: 2015-06-12 11:15:53
On 2015-06-12 1:09 AM, Markus Pieper wrote:
> Hi there,
>
> I´m new to boost so this might be a silly question.
>
> We have a simulation that is written in C++ and compiled as a static lib.
> It uses a few boost (v1.56) functions like thread.
>
> My job is to create a WPF GUI, that uses this lib. For that, I created a
> C++ CLR DLL which interacts as a wrapper between .NET GUI and the unmanaged
> libs.
>
> Everything works fine but closing my program results in a crash. This crash
> is described here: http://stackoverflow.com/questions/8144630/mixed-mode-c-
> cli-dll-throws-exception-on-exit
> And someone replied, that the reason for this lies in the exception_ptr.hpp
> beacause a "static exception_ptr ep" is being used instead
> of "exception_ptr ep".
> When I delete the static attribute, my program ends normally without the
> crash.
>
> My understanding of C++ is not that big, so I can´t say why it crashes
> here. But the boost programmers have a reason to do so.
>
> I also followed These advices
> (http://thread.gmane.org/gmane.comp.lib.boost.user/44515) but with no
> further luck.
>
> Best regards,
> Markus
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
I'd like to make a suggestion based on experience. I've had to do
exactly what you're describing and build a WPF UI on a C++ simulation
application. Use .Net's System.Runtime.InteropServices with DllImport
and wrap your C++ lib in a plain C DLL. It doesn't take as long as you
might think but it is more work. You'll have better separation of
responsibilities and it doesn't prevent the use of Boost.
Damien
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net