{"id":42473,"date":"2003-09-16T11:00:00","date_gmt":"2003-09-16T11:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2003\/09\/16\/why-does-win32-fail-a-module-load-if-an-import-could-not-be-resolved\/"},"modified":"2003-09-16T11:00:00","modified_gmt":"2003-09-16T11:00:00","slug":"why-does-win32-fail-a-module-load-if-an-import-could-not-be-resolved","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20030916-00\/?p=42473","title":{"rendered":"Why does Win32 fail a module load if an import could not be resolved?"},"content":{"rendered":"\n<p>         Because we tried it the other way and it was much worse.      <\/p>\n<\/p>\n<p>         In 16-bit Windows, a module that didn&#8217;t satisfy all its imports would still load.         As long as you didn&#8217;t call a missing import, you were fine. If you did try to call         a missing import, you crashed pretty spectacularly with the dreaded <a href=\"http:\/\/www.xploiter.com\/programming\/c\/borland\/658.html\">Unrecoverable         Application Error<\/a> dialog.      <\/p>\n<p>         The Win32 folks decided that this was a bad design, because often people would take         Fred App, designed for Windows 3.1, and run it on Windows 3.0, and it would run great         for about an hour, at which point Fred App would call a function that was available         only in Windows 3.1 (like, say, <code>GetSaveFileName<\/code>) and crash as a result.      <\/p>\n<p>         So the Win32 folks decided that if an import could not be resolved, the app should         fail loading. If the makers of Fred App wanted to run on Windows 3.0 after all, they         could indicate this by using <code>GetProcAddress<\/code> explicitly. Because if you         have to call <code>GetProcAddress<\/code> explicitly, it&#8217;ll probably occur to you to         check the return value.      <\/p>\n<p>          This issue comes up occasionally when people wish out loud, &#8220;Gosh, there should be         a way I could mark an import as &#8216;optional&#8217; &#8211; if it couldn&#8217;t bind, the load should         not fail. It would be the app&#8217;s responsibility to verify that the bind succeeded before         calling it.&#8221; These people are unwittingly asking for history to repeat itself.       <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Because we tried it the other way and it was much worse. In 16-bit Windows, a module that didn&#8217;t satisfy all its imports would still load. As long as you didn&#8217;t call a missing import, you were fine. If you did try to call a missing import, you crashed pretty spectacularly with the dreaded Unrecoverable [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-42473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Because we tried it the other way and it was much worse. In 16-bit Windows, a module that didn&#8217;t satisfy all its imports would still load. As long as you didn&#8217;t call a missing import, you were fine. If you did try to call a missing import, you crashed pretty spectacularly with the dreaded Unrecoverable [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/42473","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=42473"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/42473\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=42473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=42473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=42473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}