I am trying to export dlls and load it dynamically during runtime. dumpbin export output for the constructor for the class gives me the below output.
1 0 000111B8 ??4myclass@nmspace@@QAEAAV01@ABV01@@Z = @ILT+435(??4myclass@nmspace@@QAEAAV01@ABV01@@Z)
typedef void (WINAPI * PCTOR) ();
I am trying to get the virtual address using below two lines.
PCTOR pCtor = (PCTOR)GetProcAddress(hinstLib, (LPCSTR)DWORD(1));
PCTOR pCtor = (PCTOR)GetProcAddress(hinstLib, "??4myclass@nmspace@@QAEAAV01@ABV01@@Z");
Then I call the constructor with the below line
pCtor ();
When I use the DWORD(1)
pCtor value - nmspace::myclass::operator=(class nmspace::myclass const &)
pCtor() works fine.
But for the second line using the actual value for the exported function pCtor value - nmspace::myclass::myclass(void)
pCtor() gives me ESP was not properly saved... error.
Can I get some help on what is the problem in this case.