I've got a DLL with following class:
Cat.h:
#ifndef CAT_H
#define CAT_H
class __declspec( dllexport ) Cat
{
class CatImpl; // Not defined here
CatImpl *cat_; // Handle
public:
Cat();
int a;
};
#endif
Cat.cpp:
#include "Cat.h"
class Cat::CatImpl
{
public:
int c1;
int c2;
};
Cat::Cat()
{
cat_ = new Cat::CatImpl();
cat_->c1 = 1;
}
Then I've got a project(in separate solution) creating an instance of this class:
Main.cpp:
#include <Windows.h>
#include "..\..\DLL\DLL\Cat.h"
int CALLBACK WinMain(
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow
)
{
Cat cat;
int x = 0;
}
Now I'm placing a breakpoint at the line:
int x = 0;
Symbols are loaded and *(cat.cat_) doesn't work:
Is there any way to view the contents of cat_?
The only way I have come up with so far is:
(int)(*((char*)cat.cat_ + 0))
Also why is the following returning 0?: