Search code examples
c++.netcomprofiling

Failed Reference to IID_ICorProfilerInfo


I am trying to build a custom .NET profiler using the Profiling API and I am having an issue with the references in the project. I am not a C++ engineer, so please bear with me.

I have created a simple COM server in Visual Studio 2010 in an ATL Server project. Everything builds fine, up until I add the code to query the interface that is being served:

HRESULT hr = pICorProfilerInfoUnk->QueryInterface( IID_ICorProfilerInfo,
                                               (void **)&m_pICorProfilerInfo );

In the head file, I am referencing the cor.h and the corprof.h header files, but I am missing something.

As a reference, I am using the code from this site Sample as a reference.

Any assistance would be appreciated and I realize this is probably obscure.


Solution

  • You're probably missing the linkage to corguids.lib, which holds the actual definition of IID_ICorProfilerInfo (in corprof.h it's only declared as extern). In the sample you mention, see Building the Source Code.