mfc with external memory manager
how can i use MFC for guid and have my code still use my memory manager?
you may find issues with how i have things setup.
i overloaded new and new [] and delete delete [], they allocate memory in their own way which isn't important. i needed to overload delete and delete [] so they could properly remove the memory that was setup as well as call the destructors. from the new new[].
outside of MFC this works ok for my needs but with MFC it uses it's own overloaded delete which causes an linker issue. (symbol delete already defined). side note if you uses new[] then you must use delete[] as the compiler put's its own bookkeeping info in there (to keep track of the number of destructors to call etc).
this may not be possible and i may have to go a different way without overloading new/delete. if you have an idea please let me know.
quack
i know that i could overload in the scope of a specific class but do not wish to derive everthing that requires dynamic allocation from this.
quack
quack
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MMem.obj
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MMem.obj
where mmem is my file
nafxcwd (some mfc file) has it's own definition of delete. which most likely other compeonents of mfc depend upon. msdn had an article posted about forcing link order for this error (overloading delete with mfc). I'm not sure how that works or even if it makes sense.
thanks
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MMem.obj
where mmem is my file
nafxcwd (some mfc file) has it's own definition of delete. which most likely other compeonents of mfc depend upon. msdn had an article posted about forcing link order for this error (overloading delete with mfc). I'm not sure how that works or even if it makes sense.
thanks
i use a 3rd party memory manager with mfc apps and one of its notes states that:
"When trying to override new/delete under MFC (which has its own version of global new/delete) the linker will complain. Inorder to fix this error, use the compiler option: /FORCE, which will force it to build an executable even with linker errors. Be sure to check those errors each time you compile, otherwise, you may miss a valid linker error." and "With MFC applications, you will need to comment out any occurance of "#define new DEBUG_NEW" from all source files."
"When trying to override new/delete under MFC (which has its own version of global new/delete) the linker will complain. Inorder to fix this error, use the compiler option: /FORCE, which will force it to build an executable even with linker errors. Be sure to check those errors each time you compile, otherwise, you may miss a valid linker error." and "With MFC applications, you will need to comment out any occurance of "#define new DEBUG_NEW" from all source files."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement