How can the stack be broken at the very start of application

旧时模样 提交于 2019-12-05 20:36:47

BTW, global or file global objects are created before the main function is called.

If an object's constructor has problems, you could see any number of defects occurring before main is called.

Review your object's constructors. You should be able to set a breakpoint in the object's constructor.

Edit 1: Memory allocation in constructor
Having a global object that has dynamic memory allocation may cause problems. The object requires that the dynamic memory allocation is initialized before the object is constructed. Try commenting out the dynamic memory allocation and see if the issue goes away.

A workaround is to create an "initialize" method that can be called after the main entry point is reached. The initialize method would perform dynamic memory allocation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!