我用MFC做了个Regular DLL,其中一个接口形如:
CString GetName(...);
或者:
void GetName(CString &);
应用程序一般这样来调用: CString name = GetName(...);或者GetName(name)
我自己用得好好的,别人使用该DLL的时候居然出现_CrtIsValidHeapPointer的异常,原因在msdn中说得很清楚:
The _CrtIsValidHeapPointer function is used to ensure that a specific memory address is within the local heap. The “local” heap refers to the heap created and managed by a particular instance of the C run-time library. If a dynamically linked library (DLL) contains a static link to the run-time library, then it has its own instance of the run-time heap, and therefore its own heap, independent of the application’s local heap. When _DEBUG is not defined, calls to _CrtIsValidHeapPointer are removed during pre