<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: error code 126 in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/4800631#M16368</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably having a DLL search path problem int he best case, and a DLL hell issue in the worse case. The error comesfrom LoadLibrary() and LoadLibrary would fail if it cannot find the DLL or one of its dependencies with the right version usually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To solve the problem, I would&lt;/P&gt;
&lt;P&gt;1- verify that the search path is set properly,&lt;/P&gt;
&lt;P&gt;2- u&lt;SPAN&gt;se the dependency walker tool to look for any obvious problems to find a dependencies,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;3- use the sysinternals utility Process Monitor&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://technet.microsoft.com/en-us/sysinternals/bb896645" target="_blank"&gt;http://technet.microsoft.com/en-us/sysinternals/bb896645&lt;/A&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;from Microsoft to trace all file access while your dll is trying to load. With this utility, you will see everything that that dll is trying to pull in and usually the problem can be determined from there.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;In the wose case, the system find the dependencies, but not the right version. What I mean is that it may find an older (or newer) version than the one you need in the search path, and before the one you expect. And that will cause the DLL or the root plugin to fail loading.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Hope that helps,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2014 10:01:17 GMT</pubDate>
    <dc:creator>cyrille</dc:creator>
    <dc:date>2014-02-07T10:01:17Z</dc:date>
    <item>
      <title>error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/4800107#M16367</link>
      <description>&lt;P&gt;I am creating my own plugin using other some dlls.&lt;/P&gt;&lt;P&gt;It reports error code 126, can't find the specificated module.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where to find more detailed debug information, for example, the missing module's name?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 03:09:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/4800107#M16367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-07T03:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/4800631#M16368</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably having a DLL search path problem int he best case, and a DLL hell issue in the worse case. The error comesfrom LoadLibrary() and LoadLibrary would fail if it cannot find the DLL or one of its dependencies with the right version usually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To solve the problem, I would&lt;/P&gt;
&lt;P&gt;1- verify that the search path is set properly,&lt;/P&gt;
&lt;P&gt;2- u&lt;SPAN&gt;se the dependency walker tool to look for any obvious problems to find a dependencies,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;3- use the sysinternals utility Process Monitor&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://technet.microsoft.com/en-us/sysinternals/bb896645" target="_blank"&gt;http://technet.microsoft.com/en-us/sysinternals/bb896645&lt;/A&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;from Microsoft to trace all file access while your dll is trying to load. With this utility, you will see everything that that dll is trying to pull in and usually the problem can be determined from there.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;In the wose case, the system find the dependencies, but not the right version. What I mean is that it may find an older (or newer) version than the one you need in the search path, and before the one you expect. And that will cause the DLL or the root plugin to fail loading.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;Hope that helps,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 10:01:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/4800631#M16368</guid>
      <dc:creator>cyrille</dc:creator>
      <dc:date>2014-02-07T10:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/5990482#M16369</link>
      <description>&lt;P&gt;Hello. I've got the same error in case of linking my plugin with&amp;nbsp;external dlls in same folder. Looks like 3ds max cannot find these dlls in same plugin folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2016 10:25:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/5990482#M16369</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-01-15T10:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9623796#M16370</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I have the strange situation, that my plugin is correctly loaded the first time I start 3dsmax. However, if I close down 3dsmax and start it up again, then I get (and keep on getting) the 126 error.&amp;nbsp;&lt;BR /&gt;This only happens with max2018, and later versions don't have this issue.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If it would happen every time, then I could understand it. But it works the first time, and fails the second/third/... time.&lt;BR /&gt;&lt;BR /&gt;Does anyone have a clue?&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 10:48:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9623796#M16370</guid>
      <dc:creator>bdenhartog</dc:creator>
      <dc:date>2020-07-08T10:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624228#M16371</link>
      <description>&lt;P&gt;I'd do what Cyrille was writing in his reply..&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 14:31:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624228#M16371</guid>
      <dc:creator>istan</dc:creator>
      <dc:date>2020-07-08T14:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624241#M16372</link>
      <description>&lt;P&gt;I know. I've tried that already &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; , but unfortunately couldn't find anything useful.&amp;nbsp;&lt;BR /&gt;If I had found something, then this still doesn't explain the loading issue. Because that would mean the loading should fail every time. And in my case, it is only the first time in which it loads correctly. After that, it fails continuously.&lt;BR /&gt;And it is only a 2018 problem. Because I also build the plugin for max2019 and up. And there this problem doesn't occur at all.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 14:36:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624241#M16372</guid>
      <dc:creator>bdenhartog</dc:creator>
      <dc:date>2020-07-08T14:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624256#M16373</link>
      <description>&lt;P&gt;Which kind of plugin is it? C++? What did Procmon report? Which dll(s) is(are) missing ?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 14:42:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9624256#M16373</guid>
      <dc:creator>istan</dc:creator>
      <dc:date>2020-07-08T14:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9625484#M16374</link>
      <description>&lt;P&gt;C++&lt;/P&gt;&lt;P&gt;The same plugin is build against max2019 sdk and 2020 sdk and there we don't have any issues.&amp;nbsp;&lt;BR /&gt;When I load 2018 the first time, I don't get the error message. The times after that, it does. This is structurally the same. Which I find strange, because if there is a dependency issue, this should also be the case the first time. (I guess &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; )&lt;/P&gt;&lt;P&gt;I attached a screenshot from dependency walker.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 05:42:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9625484#M16374</guid>
      <dc:creator>bdenhartog</dc:creator>
      <dc:date>2020-07-09T05:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9626624#M16375</link>
      <description>&lt;P&gt;Could you show the DLL which cannot be loaded first? It is in the bottom list of Dependency Walker&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 16:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9626624#M16375</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2020-07-09T16:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9628412#M16376</link>
      <description>&lt;P&gt;Gentlemen, thanks for the response.&lt;BR /&gt;I have fixed the issue.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;BR /&gt;After trying many things, I came across a webpage&lt;BR /&gt;&lt;A href="https://area.autodesk.com/blogs/max-station/n88_if_you_can_run_3ds_max_only_once/" target="_blank" rel="noopener"&gt;https://area.autodesk.com/blogs/max-station/n88_if_you_can_run_3ds_max_only_once/&lt;/A&gt;&lt;BR /&gt;In which they refererred to another page:&lt;/P&gt;&lt;P&gt;&lt;A href="http://download.autodesk.com/global/docs/3dsmaxsdk2012/en_us/index.html?url=files/GUID-0C178DAC-7F0C-47E8-8994-8C2E2AAA411-669.htm,topicNumber=d28e48060" target="_blank" rel="noopener"&gt;http://download.autodesk.com/global/docs/3dsmaxsdk2012/en_us/index.html?url=files/GUID-0C178DAC-7F0C-47E8-8994-8C2E2AAA411-669.htm,topicNumber=d28e48060&lt;/A&gt;&lt;BR /&gt;There they also describe a 126 error:&lt;BR /&gt;---&lt;/P&gt;&lt;P class="section_title_h1"&gt;Load Order Dependencies between Plug-ins&lt;/P&gt;&lt;P&gt;The deferred plug-in DLLs are loaded when a certain user action requires them to be present. Because the sequence of user actions is not always predictable, the order in which deferred plug-in DLLs are loaded by 3ds Max will not be deterministic. In general, Plug-in DLL A has a load order dependency on plug-in DLL B if B needs to be loaded in 3ds Max's address space before A. If plug-in DLL A calls a function exported from plug-in DLL B, a load order dependency will exist between the two plug-in DLLs.&lt;/P&gt;&lt;P&gt;If the plug-in DLL B is defer loaded:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plug-in DLL A may fail to be loaded by the operating system's loader. In thiscase error 126 (The specified module could not be found) is displayed by the operating system. This is the case if plug-in DLL A links against plug-in DLL B.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A run-time error may occur if plug-in DLL A tries to acquire the address of a function exported by plug-in DLL B (with a call to WINAPI&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="code"&gt;GetProcAddress()&lt;/SPAN&gt;) and call that function.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution to this problem is to eliminate the load order dependency between the two plug-in DLLs by:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Moving the functionality that the plug-in DLL A (and possibly plug-in DLL B) relies on into a new DLL C that is not a plug-in and that any plug-in DLLs can either link against or load at runtime.&lt;UL&gt;&lt;LI&gt;The DLL containing the common functionality should not be&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://download.autodesk.com/msdn.microsoft.com/en-us/library/151kt790.aspx" target="_blank" rel="noopener"&gt;delay loaded&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if it exposes core interfaces to MAXScript. The delay loading mechanism may result in the core interface not being properly registered and 3ds Max may crash when client code requests such an interface.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Exposing the functionality plug-in DLL A relies on as a core interface (an object that derives from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="code"&gt;&lt;A href="http://download.autodesk.com/global/docs/3dsmaxsdk2012/en_us/cpp_ref/class_f_p_static_interface.html" target="_blank" rel="noopener"&gt;FPStaticInterface&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and is created with the&lt;SPAN class="code"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://download.autodesk.com/global/docs/3dsmaxsdk2012/en_us/cpp_ref/ifnpub_8h.html#ad157e4ec8f95763c9ef76f2d2124bfdd" target="_blank" rel="noopener"&gt;FP_CORE&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;flag). Plug-in DLLs that expose core interfaces are guaranteed to be loaded on demand, when client code acquires the core interface they expose.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This led me to check&amp;nbsp; our 2 plugins.&amp;nbsp;&lt;BR /&gt;Both have this:&lt;BR /&gt;--&lt;/P&gt;&lt;PRE&gt;// The plug-in opts out from 3ds Max’s defer loading mechanism, 
// i.e. it’s always loaded when 3ds Max starts up.
__declspec( dllexport ) ULONG CanAutoDefer()
{
   return FALSE;
}&lt;/PRE&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, only one had:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;--&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You will also need to add this line to the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="filePath"&gt;*.DEF&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;file. Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="codeBlock"&gt;&lt;PRE&gt; CanAutoDefer @5&lt;/PRE&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The plugin that did not have this line in the *.def file was not the plugin that failed to load though... But when I corrected this, and added the given line to that plugin so they are both the same. The problem was gone! So apparently max2018 does something different wrt the loading of plugins than max2020 and up.&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 10 Jul 2020 12:25:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/9628412#M16376</guid>
      <dc:creator>bdenhartog</dc:creator>
      <dc:date>2020-07-10T12:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: error code 126</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/10313009#M16377</link>
      <description>&lt;P&gt;just uninstall and reinstall the last version that you downloaded it&lt;/P&gt;</description>
      <pubDate>Fri, 14 May 2021 13:22:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/error-code-126/m-p/10313009#M16377</guid>
      <dc:creator>bubo3d</dc:creator>
      <dc:date>2021-05-14T13:22:54Z</dc:date>
    </item>
  </channel>
</rss>

