Virtual Function Tables

[The feature associated with this page, Custom File and Stream Handlers, is a legacy feature. It has been superseded by MediaStreamSource class. MediaStreamSource class has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaStreamSource class instead of Custom File and Stream Handlers, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

A virtual function table is an array of pointers to the methods an object supports. If you're using C, an object appears as a structure whose first member is a pointer to the virtual function table (lpVtbl); that is, the first member points to an array containing function pointers. The methods all take a pointer to the function table as the first parameter. Thus, the following example calls the Read method of a pStream object:

pStream->lpVtbl->Read(pStream, parameters) 
 

In C+ +, the pointer to the virtual function table, the this pointer, is implicit. The following is equivalent to the previous example when using C+ +:

pStream->Read(parameters)