Virtual functions

Started by
1 comment, last by Ultraseamus 15 years, 7 months ago
I am working with Visual Studio, in C++. I have an abstract class with a big list of virtual functions. And a class that inherits from this abstract class which provides its own definitions for these virtual functions. Recently I added 2 new virtual functions to this list, and everything seemed to work fine. Until it was run in release, which crashed the game and even trashed the stack (so probably some horrific memory override deal). This happens without the functions being called at all, and by commenting out the virtual function declarations (leaving in their counterparts in the inheriting class) everything seems to work fine. It seems to me that there must be some issue with the virtual lookup table, but I have no idea why something like that would be happening. Any help would be greatly appreciated. [Edited by - Ultraseamus on September 17, 2008 12:23:39 PM]
Advertisement
There's a non-zero chance that what you are describing could occur due to different translation units seeing different versions of your base class. If this is the case, then cleaning and rebuilding your project may fix things.
I think I figured it out, it is not exactly what you said, but close, and it got me on the right track. This program runs between multiple projects creating .dlls and .exes. It looks like this base class may have been updated in one but not the other. So each part of the program had a different idea of how large the virtual lookup table was. From here the idea of memory corruption happening seems reasonable, so while I am still testing my theory I feel confident that this was the problem. Thanks for your help.

This topic is closed to new replies.

Advertisement