tags:

views:

207

answers:

2

I have heard this term, "vtable fixup", used. What does it mean? I had no success asking Google. I already know what a vtable is so that does not need to be defined.

+2  A: 

For me, Google revealed that vtable fixups are a special feature of the PE (Windows) executable file format. They provide an efficient way of implementing vtables (for C++ and other languages), according to ECMA's PE spec:

Certain languages, which choose not to follow the common type system runtime model, may have virtual functions which need to be represented in a v-table. These v-tables are laid out by the compiler, not by the runtime. Finding the correct v-table slot and calling indirectly through the value held in that slot is also done by the compiler. The VtableFixups field in the runtime header contains the location and size of an array of Vtable Fixups (see clause 14.5.1). V-tables shall be emitted into a read-write section of the PE file.

Each entry in this array describes a contiguous array of v-table slots of the specified size. Each slot starts out initialized to the metadata token value for the method they need to call. At image load time, the runtime Loader will turn each entry into a pointer to machine code for the CPU and can be called directly.

Potatoswatter
+3  A: 

The simple answer: It's a hack to allow code generated by different compilers / languages to coexist. It allows the runtime to find the locations of virtual functions without knowing the details of the implementation.

An Onion That is Red
thanks. that's all i was looking for.
Sid Tulley