<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>day34 &amp;mdash; Gerrit Niezen</title>
    <link>https://gerritniezen.com/tag:day34</link>
    <description>Maker of open-source software and hardware.</description>
    <pubDate>Thu, 30 Apr 2026 07:08:52 +0000</pubDate>
    <image>
      <url>https://i.snap.as/aMPXpIot.png</url>
      <title>day34 &amp;mdash; Gerrit Niezen</title>
      <link>https://gerritniezen.com/tag:day34</link>
    </image>
    <item>
      <title>Getting a Node.js library using libmtp working on Windows</title>
      <link>https://gerritniezen.com/getting-a-node-js-library-using-libmtp-working-on-windows?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[This is a follow-on to Part 1 and Part 2 of my adventures in connecting to Android devices over MTP using Node.js, on Windows.&#xA;&#xA;While compiling the Node.js native module, I got the following error:&#xA;&#xA;Macro definition of snprintf conflicts with Standard Library function declaration&#xA;&#xA;Searching StackOverflow led to this solution, which I added to the libmtp source code:&#xA;&#xA;if MSCVER &lt; 1900&#xA;define snprintf snprintf&#xA;endif&#xA;&#xA;I also kept on getting a &#34;Module not found&#34; error, until I re-read my own post and used Dependency Walker to figure out that for some reason my .node file is looking for libmtp-9.dll.dll instead of libmtp-9.dll. 🤷‍♂️️ I also had to copy libusb-1.0.dll into the same folder, as it was looking for that too.&#xA;&#xA;Finally, like magic, I was able to connect to a device on Windows over MTP with my own Node.js library using libmtp, instead of the Windows MTP implementation that can only be accessed through Windows Explorer or the Windows APIs.&#xA;&#xA;And I just submitted a PR to get Windows builds fixed in the upstream libmtp library.&#xA;&#xA;Next step: Getting it compiled for 32-bit Windows using i686-w64-mingw32 and/or i686-mingw32&#xA;&#xA;---&#xA;I’m publishing this as part of 100 Days To Offload. You can join in yourself by visiting https://100daystooffload.com.&#xA;&#xA;#100DaysToOffload #day34 #libmtp #Node.js&#xA;&#xA;iComment on this post/i&#xD;&#xA;div id=&#34;cusdisthread&#34;/div]]&gt;</description>
      <content:encoded><![CDATA[<p>This is a follow-on to <a href="https://gerritniezen.com/attempting-to-get-libmtp-compiled-on-windows">Part 1</a> and <a href="https://gerritniezen.com/more-adventures-with-libmtp">Part 2</a> of my adventures in connecting to Android devices over MTP using Node.js, on Windows.</p>

<p>While compiling the Node.js native module, I got the following error:</p>

<pre><code>Macro definition of snprintf conflicts with Standard Library function declaration
</code></pre>

<p><a href="https://stackoverflow.com/questions/51897245/visual-studio-macro-definition-of-snprintf-conflict">Searching StackOverflow</a> led to this solution, which I added to the libmtp source code:</p>

<pre><code class="language-c">#if _MSC_VER &lt; 1900
#define snprintf _snprintf
#endif
</code></pre>

<p>I also kept on getting a “Module not found” error, until I re-read <a href="https://gerritniezen.com/using-libavutils-lzo-algorithm-in-node-js-part-5">my own post</a> and used Dependency Walker to figure out that for some reason my <code>.node</code> file is looking for <code>libmtp-9.dll.dll</code> instead of <code>libmtp-9.dll</code>. 🤷‍♂️️ I also had to copy <code>libusb-1.0.dll</code> into the same folder, as it was looking for that too.</p>

<p>Finally, like magic, I was able to connect to a device on Windows over MTP with my own Node.js library using libmtp, instead of the Windows MTP implementation that can only be accessed through Windows Explorer or the Windows APIs.</p>

<p>And I just submitted <a href="https://github.com/libmtp/libmtp/pull/41">a PR to get Windows builds fixed in the upstream libmtp library</a>.</p>

<p>Next step: Getting it compiled for 32-bit Windows using <code>i686-w64-mingw32</code> and/or <code>i686-mingw32</code></p>

<hr/>

<p>I’m publishing this as part of 100 Days To Offload. You can join in yourself by visiting <a href="https://100daystooffload.com">https://100daystooffload.com</a>.</p>

<p><a href="https://gerritniezen.com/tag:100DaysToOffload" class="hashtag"><span>#</span><span class="p-category">100DaysToOffload</span></a> <a href="https://gerritniezen.com/tag:day34" class="hashtag"><span>#</span><span class="p-category">day34</span></a> <a href="https://gerritniezen.com/tag:libmtp" class="hashtag"><span>#</span><span class="p-category">libmtp</span></a> <a href="https://gerritniezen.com/tag:Node" class="hashtag"><span>#</span><span class="p-category">Node</span></a>.js</p>

<p><i>Comment on this post</i>
<div id="cusdis_thread" id="cusdis_thread"></div></p>
]]></content:encoded>
      <guid>https://gerritniezen.com/getting-a-node-js-library-using-libmtp-working-on-windows</guid>
      <pubDate>Fri, 29 May 2020 15:17:11 +0000</pubDate>
    </item>
  </channel>
</rss>