View Full Version : Use MFC in a Static Library OR in a Shared DLL

February 23, 2004, 20:57:21
When the project setting for my application is 'Use MFC in a Static Library', there is no problem. But when the setting is 'Use MFC in a Shared DLL', the compiler gives errors in Released mode, and in Debug mode the .exe is built but this time i face with 'Debug Assertion Failed!' errors when i run the application.

Debug Assetion Failed!
Program: ....exe
File: dbgheap.c
Line: 1011
Expression: _CrtIsValidHeapPointer(pUserData)

Stefan Geissler
February 24, 2004, 16:39:46

An error in _CrtIsValidHeapPointer( ) always indicates, that you use a mix of debug and release compiled DLLs. If you create a debug version of your application, always use only the debug version of IC Imaging Control DLLs, located in “classlib\debug” directory of your IC Imaging Control installation. If your application is compiled as release version, then only use the release version of the IC Imaging Control DLLs, located in “classlib\release” or “bin” directory of your IC Imaging Control installation.
If you have copied the IC Imaging Control DLLs, to one the the Windows search pathes, e.g. “Windows\system32” and the working directory of your application does not contain any IC Imaging Control DLLs, then the DLLs from the search path are loaded. This causes a mix of debug and release versions of application and DLLs.
The heap management of debug versions differs from heap management of release versions. Therefore heap errors will occur, if a debug / release mix is used.

March 24, 2004, 18:18:42
I am also experiencing this same problem but mine occurs when linking MFC as a static library. Have you solved your problem? When I compile the DemoApp as it comes from the distribution CD, it works fine. When I change the project settings to use a static library then I experience the assert.

Stefan Geissler
March 25, 2004, 08:58:57
Hello Linda,

Sorry, but it is not possible to link the static MFC libs.