Wine HQ

  WineHQ Menu
  WineHQ
  AppDB
  Bugzilla
  Wine Wiki
  Wine Forums
  About
  Introduction
  Features
  Screenshots
  Contributing
  News Blog
  World Wine News
  Press
  License
  Download
  Get Wine Now
  Support
  Getting Help
  FAQ
  Documentation
  HowTo
  Live Support Chat
  Paid Support
  Development
  Developers Guide
  Mailing Lists
  GIT
  Sending Patches
  To Do Lists
  Fun Projects
  Janitorial
  Winelib
  Status
  Resources
  WineConf
  Languages
English English
Español Español
  Search WineHQ

Logical Object Layout

13.4. Logical Object Layout

The objects are split into the generic part (essentially the fields for Main) and a private part. This is necessary because some objects can be created with CoCreateInstance, then Initialized later. Only at initialization time do we know which class to use. Each class except Main declares a Part structure and adds that to its Impl.

For example, the DIBTexture DirectDrawSurface implementation looks like this:

        struct DIBTexture_DirectDrawSurfaceImpl_Part
        {
                union DIBTexture_data data; /*declared in the real header*/
        };

        typedef struct
        {
                struct DIB_DirectDrawSurfaceImpl_Part dib;
                struct DIBTexture_DirectDrawSurfaceImpl_Part dibtexture;
        } DIBTexture_DirectDrawSurfaceImpl;
      

So the DIBTexture surface class is derived from the DIB surface class and it adds one piece of data, a union.

Main does not have a Part structure. Its fields are stored in IDirectDrawImpl/IDirectDrawSurfaceImpl.

To access private data, one says

        DIBTexture_DirectDrawSurfaceImpl* priv = This->private;
        do_something_with(priv->dibtexture.data);