I have an application that loads dlls that depend on other dlls that I want to custom load. The problem I’m having is that my definition of __pfnDliFailureHook2 in one dll does not get carried over when loading other dlls. Defining the vairable as dllexport gives me a redefinition error as it is already defined in delayhlp.cpp without a corresponding dllimport.
What is the right way to define a consistent global variable like this across dlls?
I have an application that loads dlls that depend on other dlls that I
Share
If all the DLLs share the same C++ runtime then they will share the same failure hook. However, it seems that some of the DLLs involved do not share runtime. And this means that you simply cannot impose your failure hook onto such a DLL.
There is no way to do that. If DLLs are to share a global variable, they must all co-operate to do so. You cannot impose it from the outside. Each DLL must opt-in.