Python.exe crashes with C++ interfaces exported to python using boost
Hi, I have developed a dll, in that I have exported the C++ interfaces as python interfaces using boost. While running the python script, which uses those interfaces, I am facing a strange problem. When I try to call the del operator on the object of a particular class in the python script, whose interfaces has been exported to python, the python.exe crashes and gives me the following error: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) When I try to debug my dll, it is crashing inside the destructor of the class, where a byte pointer is being deleted. Although the delete operator on the same type of object works fine when i try to do the same kind of operation from a sample C++ application using my dll. I have checked the project properties etc. and my dll uses Debug Multithreaded DLL and Multithreaded DLL, for the runtime library, for debug and release builds. I have also tried with both debug and release dlls. Please help, Thanks, Mayank
Hello mayankg, Friday, May 14, 2004, 3:05:24 PM, you wrote: miai> _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) This error often happens when there are two or more instances of C runtime libraries exist in one application. May be python.exe linked with static version of library, and your dll with dll version of C runtime. Memory allocated in your dll may be freed in python.exe. But python.exe in this case uses different heap when your dll. You should ensure that python.exe linked with dll version of C runtime too. By my opinion, it is only way to get things work. -- Best regards, Владимир mailto:vkrasovsky@yandex.ru
mayankg@iiitb.ac.in writes:
Hi, I have developed a dll, in that I have exported the C++ interfaces as python interfaces using boost.
While running the python script, which uses those interfaces, I am facing a strange problem.
When I try to call the del operator on the object of a particular class in the python script, whose interfaces has been exported to python, the python.exe crashes and gives me the following error:
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
When I try to debug my dll, it is crashing inside the destructor of the class, where a byte pointer is being deleted.
Although the delete operator on the same type of object works fine when i try to do the same kind of operation from a sample C++ application using my dll.
I have checked the project properties etc. and my dll uses Debug Multithreaded DLL and Multithreaded DLL, for the runtime library, for debug and release builds.
I have also tried with both debug and release dlls.
Are you building your dll using Boost.Build? If not, you are almost certainly getting the build wrong. See the admonition in the Boost.Python tutorial. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
participants (3)
-
David Abrahams
-
mayankg@iiitb.ac.in
-
Владимир Красовский