Search code examples
c++visual-c++virtual-functionsvtable

Visual C++ Compiler Option To Dump Class Hierarchy


Is there any compiler option in MS Visual C++ equivalent to GCC's -fdump-class-hierarchy? i.e. showing the virtual function table layout.


Solution

  • try

    cl.exe /d1reportAllClassLayout test.cpp

    The output is something like:

    class request_handlerAttribute  size(8):
            +---
     0      | name
     4      | sdl
            +---
    
    
    
    class perfmonAttribute  size(8):
            +---
     0      | name
     4      | register
            |  (size=3)
            +---
    
    

    Found doing:

    + findstr /i class c1xx.dll > c1xx.txt
    + and then manually inspecting c1xx.txt

    Hope it can help, Benedetto

    PS: This obviously is an undocumented and unsupported switch.
    Look also here for a similar switch.