Boost logo

Boost Users :

Subject: [Boost-users] Windows: Mixed .NET and native C++ with Boost
From: Richwin, Dr. Matthias (M.Richwin_at_[hidden])
Date: 2010-01-14 03:05:49


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)
"

The call stack at that moment is as follows ("Application.exe" is my Windows Forms Application):

> msvcr90d.dll!_msize_dbg(void * pUserData=0x8914c5e3, int nBlockUse=2) Zeile 1511 + 0x30 Bytes C++
         msvcr90d.dll!_dllonexit_nolock(int (void)* func=0x89521903, void (void)* * * pbegin=0x0012f000, void (void)* * * pend=0x0012eff8) Zeile 295 + 0xd Bytes C
         msvcr90d.dll!__dllonexit(int (void)* func=0x89521903, void (void)* * * pbegin=0x0012f000, void (void)* * * pend=0x0012eff8) Zeile 273 + 0x11 Bytes C
         Application.exe!_onexit(int (void)* func=0x0046dce0) Zeile 110 + 0x1b Bytes C
         Application.exe!atexit(void (void)* func=0x0046dce0) Zeile 127 + 0x9 Bytes C
         Application.exe!boost::re_detail::`dynamic initializer for 'block_cache''() Zeile 191 + 0x2b Bytes C++
         [Übergang von Verwaltet zu Systemeigen]
         Application.exe!_initterm(void** pfbegin = 0x0046E3A4, void pfend = ) Zeile 130 C++
         Application.exe!<CrtImplementationDetails>::LanguageSupport::InitializeNative() Zeile 555 C++
         Application.exe!<CrtImplementationDetails>::LanguageSupport::_Initialize() Zeile 678 C++
         Application.exe!<CrtImplementationDetails>::LanguageSupport::Initialize() Zeile 876 C++
         Application.exe!?.cctor@@$$FYMXXZ() Zeile 922 + 0x9 Bytes C++
         [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für mscorwks.dll]
         ntdll.dll!7c91d39c()
         kernel32.dll!7c839736()
         ntdll.dll!7c91d39c()
         kernel32.dll!7c839736()
         kernel32.dll!7c809b32()
         kernel32.dll!7c80ae80()
         ntdll.dll!7c91dfac()
         kernel32.dll!7c8329b0()
         mscoree.dll!79007c24()
         kernel32.dll!7c817067()

To me, it looks like the DLL initialization failed.

Is anybody out there who might help me with this issue? I am completely new to this .Net thing...

Best regards
Matthias

Leopold KOSTAL GmbH & Co. KG - Sitz Lüdenscheid, Registergericht Iserlohn HRA 2854, phG Kostal Verwaltungsgesellschaft mbH, Registergericht Iserlohn HRB 4061 - USt-Id-Nr./Vat No.: DE 125800885
Post- und Werksanschrift: An der Bellmerei 10, D-58513 Lüdenscheid * Telefon: +49 2351 16-0 * Telefax: +49 2351 16-2400 Bellmerei
Geschäftsführung: Dipl.-Kfm. Helmut Kostal (Vorsitzender), Dipl.-Oec. Andreas Kostal, Dipl.-Wirtsch.-Ing. Hermann Eidel, Dipl.-Ing. Marwin Kinzl, Dr.-Ing. Ludger Laufenberg



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