1

I'd like to get some clarification on something that I've been confused on for awhile.

I've tried to read as much documentation (both 1st and 3rd party) on the generation of IDL and MetaData files for Runtime Components as I could, and perhaps it lies in my ability to comprehend the material, but I'm still a little (very) lost.

If I understand correctly, once a Runtime Component is compiled into a DLL, that is used to generate an IDL file which is then used in the creation of windows meta data files. In the MS sample app Chatterbox VoIP, the Runtime component project has a custom build step (PostBuildEvent) that does the following:

pushd "$(OutDir)"

WinMdIdl.exe "$(OutDir)$(RootNamespace).winmd"

MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(FrameworkSdkDir)Windows Metadata" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).idl"

MIdl.exe /env $(MidlEnv) /winrt /ns_prefix /metadata_dir "$(FrameworkSdkDir)Windows Metadata" /out "$(SolutionDir)$(ProjectName)ProxyStub" "$(OutDir)$(RootNamespace).OutOfProcess.idl"

"$(ProjectDir)OopServerRegistrationHelper.exe" /winmd:"$(OutDir)$(RootNamespace).winmd" /dll_name:$(TargetName) /namespace:$(RootNamespace).OutOfProcess /app_manifest:"$(SolutionDir)UI\Properties\WMAppManifest.xml" /helper_dir:"$(SolutionDir)Agents"

popd

However, in a project of my own, using a simple c++ class in a Runtime component referenced in a C# app, I never did any manual configuration for the creation/processing of IDL files. I simply added a reference in the C# project to my C++/CX Runtime Project, compiled, and it worked.

So, what is the deal here? Are the IDL and WinMD files automatically generated for every Runtime Component Project? Or am I doing something incorrectly/inefficiently by not using these IDL processing tools?

Let me know if I need to include any more information.

HarryHippo
  • 267
  • 1
  • 2
  • 9
  • 2
    No, this sample is special, it demonstrates an out-of-process component. The BackEnd project is a separate executable, the build steps are required to generate the proxy/stub DLL that are needed to marshal the calls between the two processes. Your C++/CX example is far simpler, it is an in-process server. You need to know COM to truly grok the difference. You are not otherwise missing anything. – Hans Passant Sep 25 '13 at 07:55
  • I actually have a follow up. When are the IDL files generated? Right after the .DLL compiles? Automatically or manually? Because after adding another project to the solution, only one IDL file is generated. The OutOfProcess.IDL never shows its face, giving me a fatal error when MIdl.exe tries to process it. – HarryHippo Sep 25 '13 at 16:29
  • Winmdidl.exe generates it from the .winmd file. – Hans Passant Sep 25 '13 at 16:49
  • You're the friggin' man, Hans. – HarryHippo Sep 25 '13 at 16:50
  • 1
    Note that in most cases you don't need the winmdidl step - you only need to run winmdidl if your types aren't agile or if you're involved in a cross process scenario and all C++/CX types are agile by default. – Larry Osterman Oct 01 '13 at 00:36

0 Answers0