Static or dynamic linking the CRT, MFC, ATL, etc

前端 未结 7 735
一整个雨季
一整个雨季 2020-12-10 11:19

Back in the 90s when I first started out with MFC I used to dynamically link my apps and shipped the relevant MFC DLLs. This caused me a few issues (DLL hell!) and I switch

相关标签:
7条回答
  • 2020-12-10 12:02

    Most definitely.

    Allocation is done on a 'static' heap. Since allocation an deallocation should be done on the same heap, this means that if you ship a library, you should take care that client code can not call 'your' p = new LibClass() and delete that object itself using delete p;.

    My conclusion: either shield allocation and deallocation from client code, or dynamically link the CRT.

    0 讨论(0)
提交回复
热议问题