I have a peculiar problem. I have two DLLs, let's call them DLL-A and DLL-B.
DLL-A has a function named f1()
and DLL-B also has function with the same name, f1()
. Now in DLL-A, f1()
is calling f1()
of DLL-B like this.
DLL-A:
f1()
{
f1(); //this is DLL-B function, but having the same name
}
Now my question is that, will it be a recursive call of f1()
from DLL-A?
The f1()
inside the function body calls itself leading to an infinite recursion, as you suspected. Some possible solutions:
GetProcAddress
. That allows you to call the imported function anything you like.You can change the name of the function in DLL-A to A_f1
.
A_f1()
{
f1() //this calls DLL-B's f1
}
In your DEF file, write
EXPORTS
f1 = A_f1
This says "The function I internally called A_f1
should be exported under the name f1
to other components." That way everybody who had been using DLL-A and calls f1
(expecting to get the function A) will get A_f1
.
I'm assuming that renaming the exported functions is not possible. If it is possible, then that is a much cleaner solution. (My guess is that it isn't possible because you are trying to hack a video game.)
They way you have written it f1 within f1 will not call DLL-B but be a infinite recursion. If you want to call DLL-B function you will have to use GetProcAddress
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With