Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Agemaniac

Doug Lea´s Malloc

This topic is 5407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!!!

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Rename it.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!