Game Development Community

Question about how I solved a link error?

by Valerie Butler · in Torque Game Engine · 06/14/2009 (10:07 am) · 6 replies

Hi guys, I was getting a linker error a while back with multiple defined functions! I tried many forums and could not solve the problem! In the end I just deleted the function in question! It was the "new" function in winMemory.cc! The game engine still compiled and ran perfect! I know it is bad practice to remove the code but it was the only solution I could find after much attempts to overcome the problem! I have now encorporated some face tracking code into my project and the game engine still runs fine but when I make the function call to initialise the face tracker API I am getting and API error and it is failing to initialise! But the game engine still runs perfect! I am just wondering would it be in any way possible that the function in winMemory.cc that I removed from the file be causing this? Would really appreciate any help! Thank you!

#1
06/14/2009 (10:51 am)
The issue has to do with memory management. TGE has its own memory manager that overrides the new and delete functions in C++. Usually when you integrate a 3rd party SDK, there is a good chance it has also overwritten the same functions. This causes a conflict between two SDKs.

The first step is to disable TGE's memory manager, instead of deleting the new function we have developed. As far as being unable to initialize, can you post your console.log error message? Having details would help debug the problem.
#2
06/14/2009 (10:51 am)
Moving this to the TGE forums to get more help.
#3
06/14/2009 (10:51 am)
Moving this to the TGE forums to get more help.
#4
06/15/2009 (7:22 am)
Thanks Michael, I actually got the tracker to initialise after, it was a problem with a misplaced resources folder, but it runs very very slow and then the game engine crashes saying that torqueDemo.exe has triggered a breakpoint! This might be something to do with what you said about memory management! How do I go about disabling torques memory manager? I have mailed you a copy of the application log printed out on the console when I run the application until torque triggers the break point! Sorry for not printing it here... I dont want to be filling up the spamming the forum with text! Thank you for you help!



#5
06/15/2009 (7:42 am)
In engine/platform/platform.h you'll see #define TORQUE_DISABLE_MEMORY_MANAGER toward the top commented out. Uncomment it to disable the memory manager.

It's been my experience that when adding 3rd party stuff to TGE you have to disable the memory manager about 70% of the time.
#6
06/15/2009 (1:54 pm)
Thanks a million Scott, appreciate your input! I shall try that :)