简体   繁体   中英

Delayloading across dlls

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?

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.

What is the right way to define a consistent global variable like this across DLLs?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM