|
Boost Users : |
Subject: Re: [Boost-users] Windows: Mixed .NET and native C++ with Boost
From: Ewald, Christian (che_at_[hidden])
Date: 2010-01-15 02:11:50
Richwin, Dr. Matthias wrote:
> Hi all,
>
> I try the following scenario:
>
> - a C++ library (my own code), unmanaged, makes use of boost (e.g.
> regex)
> - a C++ .NET application (windows forms based) planned as GUI (having
> used Borland C++ builder in the past, the windows forms approach looks
> quite appealing to me)
>
> - my C++ library header is included in the .Net form header file
> wrapped in a #pragma unmanaged/managed pair.
>
> I compiles and links well.
>
> For simple test purposes, I instantiate a class from my C++ library in
> the form constructor. Calling some unmanaged code from my library
> there creates a debug assertion:
>
> "Debug Assertion Failed!
> [...]
> Expression: _CrtIsValidHeapPointer(pUserData)
Well, its a bit off topic, and I don't know exactly the cause of the assertion failure.
But, I have a different approach for you:
I usually pack all my unmanaged/native C++ stuff in static libraries and link them into a managed C++ class library. By adding some managed C++ wrapping code, hiding all unmanaged stuff from the class libraries' interface, I'm even able to use such class libraries from C# or other CLR languages.
I did this several times, with alot of boost on the unmanaged side.
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