Doug Lea´s Malloc
Hi, im trying to override de default malloc in my program. Im using Microsoft Visual C++ 6.0. So, i downloaded the file malloc.c and include it in my project. When i try to compile i got errors about like
LIBCD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in malloc.obj
i have tried to ignore default libraries but it doesnt work.
Does anyone knows what can i do?
thanks!!!
Thanks for the replies. But, if i rename it using
#define malloc my_malloc will my program use my_malloc instead of malloc? how can i overload it? i thought i could ignore the default malloc, so, when i call malloc it would call the new malloc. If i use the
#define malloc my_malloc how can i use it in a large program that is already working with malloc.
#define malloc my_malloc will my program use my_malloc instead of malloc? how can i overload it? i thought i could ignore the default malloc, so, when i call malloc it would call the new malloc. If i use the
#define malloc my_malloc how can i use it in a large program that is already working with malloc.
I think lucinpub used my_malloc as a placeholder for your function name -- which means you shouldnt have to change anything. The precompiler will replace every ''malloc'' to ''my_malloc'' or any other name youve given it like ''doug::malloc'' if thou art using namespaces
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement