Register for free COM without copying the DLL to the same directory as the executable

How can I use a free COM object to register without copying the DLL into the same directory as the executable? Is it possible?

I need a full working sample or a detailed walkthrough for my exact scenario.

For example, I have the following components:
CppTestRunner.exe - vC ++ console application
CppTests.dll - vC ++ mfc dll
CsCOMServer.dll - C # COM visible dll

I do not want to modify exe or its directory, for example adding an external manifest.
CppTests.dll is located in a different directory than exe.
This is normal if CsCOMServer.dll is in the same directory as CppTests.dll.

CppTestRunner.exe calls LoadLibrary on CppTests.dll, which works fine.

After implementing the manifest and using the windows apis activation context, I was able to copy CsCOMServer.dll to the exe directory to make sure CppTests.dll can create an instance of CsCOMServer.dll without problems, but again, I try to avoid this step.

Currently, with CsCOMServer.dll in the same directory as CppTests.dll, and without CsCOMServer.dll in the exe directory, I get the following error when calling CoCreateInstance:
Error = 0x80070002 The system cannot find the file specified.

sysinternals , CppTestRunner.exe ..
, , , CppTestRunner.exe CsCOMServer.dll.config , CppTests.dll, , , .
, , , CppTestRunner.exe CsCOMServer.dll , CppTests.dll, - .

- ?

, , , unit\integration.

, CppTestRunner.exe , CppTests.dll, , .

.

+3
2

.NET COM GAC, . , .

+2

DLL , DLLFolder\YourDll.dll, yourDll ,

<file name = "DLLFolder\YourDll.dll">

(DLL) , EXE.

+1

All Articles