I created an ATL COM DLL. I now have to unit test the methods defined in the COM interface of the DLL. I created a console application "tester.exe" and wrote some google tests, which would talk to the COM DLL and its method. Problem is, the tester.exe only compiles if I explicitly export the COM method like:
__declspec(dllexport) STDMETHOD(Add)(DOUBLE Input1, DOUBLE Input2, DOUBLE* pOutput);
I want to test the COM interface directly and not rely on a DLL export. Is there any way my tester/com client can compile and run the dll without needing the dllexport, such that the method definition stays:
STDMETHOD(Add)(DOUBLE Input1, DOUBLE Input2, DOUBLE* pOutput);
Am I missing something very obvious? I tried looking at many resources and tutorials but none were very helpful.
I was able to resolve this issue by directly setting the CLSID and IDD in the test class:
and then using these to create a CoCreateInstance
With this, I neither need the lib of the COM server when compiling, nor any header.