CLR intervenes in C ++ STD?

I have a compilation of code under clr and other code that is unmanageable in one project.

My common.h file includes all the std library headers I need. It is part of manager.h (forward declaration for manager.cpp (without CLR)), which is included main_window.h (WinForm), which is included document_manager.cpp (CLR).

At runtime, I get all kinds of strange behavior, in one case my form does not load. Suspending the debugging program several times showed that it was stuck in reallocating memory for std :: string, in malloc.c. By changing the code, I can get a System :: InvalidMemory (I think) exception in ostream.

How to stop the CLR from managing the std library?

If someone wants the source to be in any of my files, just ask.

Edit: In callstack, I have managed code that runs when my form loads. In the init init callback, I have my own branch, and then my manager class. I get to later

    std::string error_msg;
    error_msg = "Storage Manager: SQLite Error ("; <-- Executing Currently
    error_msg += sqlite3_errcode(this->db_p);
    error_msg += ") - ";
    error_msg += sqlite3_errmsg(this->db_p);
    *(this->log) << error_msg.c_str() << std::endl;

and callstack shows std :: basic_string :: assign, then some other std :: functions, and finally the malloc function, in which it constantly gets stuck.

Edit: Exception that throws on a file entry:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at manager.file_open(manager* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* )
   at DocumentManager.main_window.file_open_mainmenu_Click(Object sender, EventArgs e) in c:\development\document manager\document manager\main_window.h:line 456
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
+3
source share
3 answers

, , . ++ , . .

"" . , prceprocessor ( ) . 32/64 - - .

Microsoft STL .

+1

, CLR CPP, STL. , CPP . .

: , CPP, .

0
source

Source: https://habr.com/ru/post/1707570/


All Articles