Using Visual Studio C ++ V10, I am trying to figure out how to create a DLL and resolve a DLL namespace conflict. Here are the details.
Company S ships a product called M.EXE . Suppose that M.EXE set to \S\BIN\M.EXE . Company S statically references a DLL called U.DLL , which is installed in \S\BIN\U.DLL . U.DLL contains open source code and is built with Visual C ++ /Zc:wchar_t- compiler options, which does not recognize wchar as a native type.
Company C sends a DLL called O.DLL and publishes an API for this DLL and sends an import library for O.DLL . Assume O.DLL installed in \C\BIN\O.DLL . O.DLL statically refers to a DLL called U.DLL , which is installed in \C\BIN\U.DLL . U.DLL built on the same open source code, but built with Visual C ++ /Zc:wchar_t compiler options /Zc:wchar_t , which recognizes wchar_t as a native type.
Ideally, company C and company S will agree to create U.DLL using the same Visual C ++ features, but this is not possible.
M.EXE from company S is expanding because I can create my own DLL in unmanaged C ++, call it NODE.DLL , which M.EXE is called if I configure everything correctly. I would like to build NODE.DLL so that it statically binds to O.DLL from company C. But the problem is that after running M.EXE it loaded the U.DLL library from \S\BIN , and the characters from \S\BIN\U.DLL slightly different from those specified in \C\BIN\U.DLL , due to how U.DLL was built by each company. Therefore, when M.EXE tries to load NODE.DLL , it fails, because when NODE.DLL loads O.DLL , which requires U.DLL , the characters needed from \C\BIN\U.DLL do not exist, since Windows sees U.DLL as it is already loading.
The situation diagram is as follows:
M.EXE static link to -> \S\BIN\U.DLL M.EXE dynamic link to -> NODE.DLL NODE.DLL static link to O.DLL O.DLL static link to \C\BIN\U.DLL
In fact, I need \S\BIN\U.DLL and \C\BIN\U.DLL coexist in the same process space and M.EXE use their version of U.DLL and O.DLL to use their version of U.DLL .
Please note that I have no way to rebuild M.EXE or O.DLL to change how each U.DLL download U.DLL . They come from third parties, so static links cannot be changed. I also have no way to use LoadLibrary on O.DLL , because it is a C ++ library equipped with an import library.
I believe that manifests can be used so that when I build NODE.DLL statically linked to O.DLL, I set things up in the NODE.DLL manifest NODE.DLL that O.DLL its own copy of U.DLL , which is set to \C\BIN\U.DLL . I just can't figure out how to do this. Ideally, I would not want to modify the O.DLL manifest, but if this is the only solution, I will live with it.