Returning Strings from DLL Functions

前端 未结 7 1158
北恋
北恋 2020-12-16 01:44

For some reason, returning a string from a DLL function crashes my program on runtime with the error Unhandled exception at 0x775dfbae in Cranberry Library Tester.exe:

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

    This occurs because you're allocating memory in one DLL (using std::string's constructor), and freeing it in another DLL. You can't do that because each DLL typically sets up it's own heap.

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