Answer the question
In order to leave comments, you need to log in
How to call thiscall-method at an address from a dll?
From a dll written in C++, I get the address of a method by name. The prototype of the method is attached. But I can't call this method because it has the __thiscall calling convention. (When you try to call, a crash occurs, which is not surprising). I have a class description, I can create an instance, how can I call this method, but so that instead of its implementation the library one is executed?
typedef int (__thiscall *LoadMap)(char const *,int);
pDll=LoadLibrary("MindPower3D_D8R.dll");
loadmapfunction=(LoadMap)GetProcAddress(hMyDll,"[email protected]@@[email protected]");
Answer the question
In order to leave comments, you need to log in
And the first parameter (char const *) is this?
Maybe it's worth importing and calling the constructor of this class from the dll (in the case of virtual methods)?
solution "on the forehead": in the class for which the method is imported, create a dummy method and call it before calling the imported function.
Fixed: [Do not believe what is written here, believe me - you will deal with crashes related to memory access rights for a long time]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question