Skip to main content
GameDev.net gamedev.net
🔒 Locked

MSVC forgetting a virtual func pointer?

Started by DanG Aug 3, 2002 at 1:30 AM 0 replies 200+ views
Original Post
DanG
DanG
I just started having a problem, and I think it must be the fault of the MSVC++ 6. In a simplified explanation, i have a class with 4 virtual functions. Another class derives from this base and implements all the vitual functions. The problem is I keep getting an debug error message during run time. Stepping through the code, i discovered the faulty point. It is in a call to a one of the virtual functions, from a base pointer that actually points to the derived class. Here what it looks like: pointer_base->Initialize(); // really points to derived Stepping through, I looked at the compiler made virtual function table. It looks like this: pointer_base->__vfptr[0] = (some address) Base::Func1 .... pointer_base->__vfptr[4] = 0x0000000 // should be Initialize() As you can see, it seems that the compiler should be filling this entry but it is not. I checked and the function Base::Initialize() does exist, with an addess, but MSVC doesn''t want to work. Any ideas as to the problem?
Ambassador: Mr. Bush are you stoned or just really, REALLY dumb?Pres. Bush - I assure you I am not stoned.
davepermen
davepermen
if you have 4 functions, it should be [0],[1],[2], and [3]. [4] should not exist, and in debugmode, it does and is set to zero. that way the debugger can check if you overwrite unallowed memory.. so far so okay..
the bug is somewhere else

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.