{"id":109825,"date":"2024-05-31T07:00:00","date_gmt":"2024-05-31T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=109825"},"modified":"2024-06-02T07:23:16","modified_gmt":"2024-06-02T14:23:16","slug":"20240531-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240531-00\/?p=109825","title":{"rendered":"A graphical depiction of the steps in building a C++ executable, with XAML and packaging"},"content":{"rendered":"<p>Last time, we generated a diagram showing <a title=\"A graphical depiction of the steps in building a C++ executable, basics\" href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240530-00\/?p=109823\"> how a C++ executable is built, augmented for classic Win32<\/a>. Let&#8217;s add in more stuff: XAML and packaging.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"p20240531_head\" style=\"display: none;\">\u00a0<\/div>\n<div id=\"p20240531_defs\" style=\"height: 0;\">\u00a0<\/div>\n<table style=\"text-align: center; border-collapse: separate; line-height: 1;\" title=\"Described in text.\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.idl<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">MIDL compiler<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td id=\"p20240531_darr5\" rowspan=\"5\">\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.winmd<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.xaml<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">C++\/WinRT compiler<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">XAML compiler<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px currentcolor; position: relative;\" colspan=\"3\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.h, .cpp<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.xbf<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.resw<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; height: 100%;\">C++ compiler<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">makepri<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr9\" rowspan=\"9\">\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.obj<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.rc, .ico, .bmp<\/td>\n<td><!-- missing td: rowspan 2 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_swarr\">\u2199<\/div>\n<\/td>\n<td style=\"position: relative;\" rowspan=\"5\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr5\">\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td><!-- missing td: rowspan 3 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; height: 100%;\">librarian<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 2 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">rc compiler<\/td>\n<td><!-- missing td: rowspan 4 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 3 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td><!-- missing td: rowspan 5 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.lib<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 4 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.res<\/td>\n<td><!-- missing td: rowspan 6 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_searr\">\u2198<\/div>\n<p><!-- missing td: rowspan 5 of 5 --><\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 7 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; height: 100%;\">linker<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 8 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 9 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.dll, .exe<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.appxmanifest<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.pri<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">packager<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.msi, .msix<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We still see the core of the compiler and linker on the left hand side, happily consuming C++ source files (.h, .cpp) producing a module (.dll, .exe). We just added still more steps that either produce C++ source files from other sources, add additional content to the resulting module, or which package the resulting module.<\/p>\n<p>If there is an .idl file, it is processed by the MIDL compiler, which (depending on what kind of IDL file you provided) may produce a .winmd file, or C source files. If you&#8217;re processing .idl files for C++\/WinRT, then the thing your project uses is the .winmd file. If you&#8217;re processing .idl files for C++\/WRL, then the thing your project uses is the .h file. And if you want your interfaces to be marshallable, you will want the .c file that compiles the proxy stubs.<\/p>\n<p>If you have a .winmd file and are using C++\/WinRT, then the C++\/WinRT compiler studies the .winmd file and produces .h and .cpp files for your project to use. (C++\/WinRT-based projects use these header files instead of the MIDL ones.)<\/p>\n<p>If you have .xaml files, then XAML compiler generates C++ source code for those .xaml files, using the .winmd files to know how to generate binding code. It also generates .xbf files (which I correctly guessed stands for <a title=\"XAML Islands - A deep dive - Part 2\" href=\"https:\/\/blogs.windows.com\/windowsdeveloper\/2018\/11\/08\/xaml-islands-a-deep-dive-part-2\/\"> XAML binary format<\/a>) which are used at runtime to generate the elements you specified in your XAML markup. The C++ source files get compiled into your project, too.<\/p>\n<p>Now that we have generated all the C++ source files, we can go through the usual procss of compiling the C++ source files to object files, and possibly generate a .lib.<\/p>\n<p>If your code uses classic Win32 resources, the resource compiler takes the .rc file and any supporting files (like .ico and .bmp) and produces a .res file, as before.<\/p>\n<p>After all the .obj, .lib, and .res files have been produced, we feed them all to the linker, which produces the resulting module, a .dll or .exe.<\/p>\n<p>If applicable to your project, the <tt>makepri<\/tt> program takes a string resource description file .resw, as well as all of the .xbf files, and produces a .pri file, which is yet another binary format for resources.<\/p>\n<p>If your final product requires packaging, then all of the .dll files, .exe files, .pri files, and any other collateral are gathered together, along with your package&#8217;s .appxmanifest, and out comes an .msi file or .msix file.<\/p>\n<p>This is a very quick overview of the build flow, but now that you see how the pieces fit together, you will be better-equipped to diagnose build problems. For example, if you get a XAML compiler error, then the things to investigate are the .xaml and .winmd files in your project, since those are the pieces that the XAML compiler uses. There&#8217;s no point investigating the manifest file when trying to diagnose a XAML compiler error.<\/p>\n<p><b>Bonus chatter<\/b>: If your project is based on C++\/CX, then the build flow is different, since C++\/CX doesn&#8217;t use .idl files but rather generates the .winmd file from your C++ sources. The resulting diagram looks weird because there is a circular dependency!<\/p>\n<table style=\"text-align: center; border-collapse: separate; line-height: 1;\" title=\"Described in text.\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.winmd<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.xaml<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_svg01\">\u2199\u2197<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_blank\">\u2193\u2191<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">XAML compiler<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_blank\">\u2193\u2191<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_blank\">\u2193\u2191<\/div>\n<\/td>\n<td style=\"border: solid 1px currentcolor; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.h, .cpp<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.xbf<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.resw<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_blank\">\u2198\u2196<\/div>\n<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 0 1ex; height: 100%;\">C++\/CX compiler<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">makepri<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr9\" rowspan=\"9\">\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.obj<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.rc, .ico, .bmp<\/td>\n<td><!-- missing td: rowspan 2 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_swarr\">\u2199<\/div>\n<\/td>\n<td style=\"position: relative;\" rowspan=\"5\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr5\">\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<br \/>\n\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td><!-- missing td: rowspan 3 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 0 1ex; height: 100%;\">librarian<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 2 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">rc compiler<\/td>\n<td><!-- missing td: rowspan 4 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 3 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td><!-- missing td: rowspan 5 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.lib<\/div>\n<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\"><!-- missing td: rowspan 4 of 5 --><\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.res<\/td>\n<td><!-- missing td: rowspan 6 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_searr\">\u2198<\/div>\n<p><!-- missing td: rowspan 5 of 5 --><\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 7 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative; padding: 0; line-height: 2em;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"border: solid 1px currentcolor; border-radius: 3ex; height: 100%;\">linker<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 8 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div id=\"p20240531_darr\">\u2193<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td><!-- missing td: rowspan 9 of 9 --><\/td>\n<\/tr>\n<tr>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"background: currentcolor; opacity: 15%;\">\u00a0<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex; position: relative;\">\n<div style=\"position: absolute; top: 0; left: 0; background: currentcolor; opacity: 15%; width: 100%; height: 100%;\">\u00a0<\/div>\n<div style=\"width: 100%; height: 100%;\">.dll, .exe<\/div>\n<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.appxmanifest<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.pri<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_searr\">\u2198<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td id=\"p20240531_swarr\">\u2199<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; border-radius: 3ex; padding: 1ex;\">packager<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td id=\"p20240531_darr\">\u2193<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<tr>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<td style=\"border: solid 1px currentcolor; padding: 1ex;\">.msi, .msix<\/td>\n<td>&nbsp;<\/td>\n<td>&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Instead of generating the .winmd from an .idl file, the .winmd is generated from the C++ sources, and the C++\/CX compiler also consumes the .winmd files when compiling the C++ sources. My understanding is that the C++\/CX compiler first makes a &#8220;metadata pass&#8221; where it parses the code only to identify the <code>ref<\/code> classes and their members. It then generates a .winmd from that information, and then later, in the &#8220;real compilation&#8221; pass, all of the .winmd files are used to provide type information to the C++\/CX compiler a second time.<\/p>\n<p>In addition to introducing a weird circular dependency, this style of automatic .winmd generation limits you to the types of things that the automatic .winmd generator understands. The automatic .winmd generator doesn&#8217;t understand Windows Runtime versioning or contracts, for example, so you can&#8217;t use it to produce a v2 API that is backward compatible with the v1 API. Once you make a change, all of your clients have to switch to the v2 API; the v1 API doesn&#8217;t work any more. This is fine for monolithic programs, but it&#8217;s bad news if you&#8217;re trying to produce reusable components.<\/p>\n<p>\n<script>\nwindow.addEventListener(\"load\", function() {\n  var fullFF = getComputedStyle(document.body).fontFamily;\n  var simpleFF = fullFF.replace(\/ Emoji\/g, \"\");\n  \/\/ break up \"style\" to prevent wordpress from injecting random junk\n  document.getElementById(\"p20240531_head\").innerHTML =\n`<s` + `tyle>\nbody { font-family: ${simpleFF}; }\n.emoji { font-family: ${fullFF}; }\n.entry-content th { padding: 1px; } \/* stylesheet workaround *\/\n.entry-content td { padding: 1px; } \/* stylesheet workaround *\/\n<\/s` + `tyle>`;\n}); \/\/ wacky comment to prevent wordpress from injecting random junk\n(function() {\n  var svg = {\n    defs: `<svg width=\"0\" height=\"0\">\n <defs>\n  <marker id=\"arrowhead\" markerWidth=\"5\" markerHeight=\"5\" refX=\"-2\" refY=\"0\"\n    viewBox=\"-6 -6 12 12\" orient=\"auto\">\n    <polygon points=\"-2,0 -5,5 5,0 -5,-5\" fill=\"currentcolor\" stroke=\"currentcolor\"\n      stroke-dasharray=\"1 0\" \/>\n  <\/marker>\n  <path id=\"darr\" d=\"M10,3 L10,15\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n  <path id=\"darr3\" d=\"M10,3 L10,85\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n  <path id=\"darr5\" d=\"M10,3 L10,125\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n  <path id=\"darr9\" d=\"M10,3 L10,235\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n  <path id=\"searr\" d=\"M3,3 L15,15\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n  <path id=\"swarr\" d=\"M20,2 L3,15\" stroke=\"currentcolor\"\n   marker-end=\"url(#arrowhead)\" \/>\n <\/defs>\n<\/svg>`,\n    darr: `<svg width=\"20\" height=\"20\"><use href=\"#darr\"\/><\/svg>`,\n    darr3: `<svg width=\"20\" height=\"90\"><use href=\"#darr3\"\/><\/svg>`,\n    darr5: `<svg width=\"20\" height=\"130\"><use href=\"#darr5\"\/><\/svg>`,\n    darr9: `<svg width=\"20\" height=\"240\"><use href=\"#darr9\"\/><\/svg>`,\n    searr: `<svg width=\"20\" height=\"20\"><use href=\"#searr\"\/><\/svg>`,\n    swarr: `<svg width=\"20\" height=\"20\"><use href=\"#swarr\"\/><\/svg>`,\n    blank: ``,\n    svg01: `<svg width=\"20\" height=\"20\" style=\"overflow: visible\">` +\n            `<path d=\"M20,125 C-10,105 -10,25 20,5\" stroke=\"currentcolor\" fill=\"transparent\" marker-end=\"url(#arrowhead)\"\/>` +\n            `<path d=\"M10,5 C-20,25 -20,105 10,125\" stroke=\"currentcolor\" fill=\"transparent\" marker-end=\"url(#arrowhead)\"\/>` +\n            `<\/svg>`,\n  };\n  Object.keys(svg).forEach(function (key) {\n    Array.prototype.forEach.call(document.querySelectorAll(\"#p20240531_\" + key),\n      function (e) {\n        e.innerHTML = svg[key];\n      });\n  });\n})();\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fleshing out the diagram.<\/p>\n","protected":false},"author":1069,"featured_media":100998,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-109825","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Fleshing out the diagram.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=109825"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109825\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/100998"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=109825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=109825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=109825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}