Undefined variable in generated header from ETW manifest file (Windows event tracing)

79 views Asked by At

I am following the "hello world" style example for the ETW API provided in https://kallanreed.com/2016/05/28/creating-an-etw-provider-step-by-step/

When I use the "mc.exe" to generate the files from the manifest like so:

C:\"Program Files (x86)"\"Windows Kits"\10\bin\10.0.15063.0\x64\mc.exe -um helloworldmetric.man

I get a header file containing the lines:

EXTERN_C __declspec(selectany) DECLSPEC_CACHEALIGN ULONG Hello_World_Metric_ProviderEnableBits[1];
EXTERN_C __declspec(selectany) const ULONGLONG Hello_World_Metric_ProviderKeywords[1] = {0x0};
EXTERN_C __declspec(selectany) const UCHAR Hello_World_Metric_ProviderLevels[1] = {0};
EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT HELLO_METRIC_Context = {0, 0, 0, 0, 0, 0, 0, 0, 1, Hello_World_Metric_ProviderEnableBits, Hello_World_Metric_ProviderKeywords, Hello_World_Metric_ProviderLevels};

EXTERN_C __declspec(selectany) REGHANDLE Hello_World_Metric_ProviderHandle = (REGHANDLE)0;

When compiling with gcc in MinGW I get a linker error as expected since no definition can be found for the variable "Hello_World_Metric_ProviderEnableBits", but building the project in Visual Studio results in no such linker error. Does anyone know why this is?

0

There are 0 answers