<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[how to add&#x2F;use external libraries in plugin]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I am trying to develop a plugin. The idea is simple I want to read <a href="https://en.wikipedia.org/wiki/Zebra_Programming_Language" rel="nofollow ugc">zpl</a> code to image. I have a <a href="https://github.com/BinaryKits/BinaryKits.Zpl/tree/master/src/BinaryKits.Zpl.Viewer" rel="nofollow ugc">Library</a> to do that. but I am not able to include this in the template provided by np++. I have also tried different <a href="https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net" rel="nofollow ugc">template proj</a> for developing plugin but still I get file not found error if I use the library.</p>
<p dir="auto">I got to know that I need to merge dlls used and I did it with ILMerge, ILRepack with not luck.</p>
<pre><code>ILMerge.exe /zeroPeKind /closed /log:debug.txt /allowDup /lib:C:\Users\josep\source\repos\zplTestViewer1\zplTestViewer1\bin\Debug-x64 /out:zplTestViewer1.dll zplTestViewer1.dll BarcodeStandard.dll BinaryKits.Zpl.Label.dll BinaryKits.Zpl.Viewer.dll HarfBuzzSharp.dll Microsoft.Bcl.AsyncInterfaces.dll Microsoft.Win32.Primitives.dll netstandard.dll SkiaSharp.dll SkiaSharp.HarfBuzz.dll zxing.dll zxing.presentation.dll
</code></pre>
<p dir="auto">so I am trying to understand is it possible to include external libraries into np++ plugins; if so how…? do we have any doc or tuts fo that…?</p>
<p dir="auto">btw I am new to all this suff. need help.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24773/how-to-add-use-external-libraries-in-plugin</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 19:29:28 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24773.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 04 Aug 2023 04:54:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sun, 13 Aug 2023 09:09:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rdipardo" aria-label="Profile: rdipardo">@<bdi>rdipardo</bdi></a> :</p>
<blockquote>
<p dir="auto">BinaryKits.Zpl.Viewer as a project reference and building it yourself.</p>
</blockquote>
<p dir="auto">sure, thanks for the suggestion. will try that way…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88562</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88562</guid><dc:creator><![CDATA[Joseph Samuel]]></dc:creator><pubDate>Sun, 13 Aug 2023 09:09:35 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sun, 13 Aug 2023 01:34:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a> ,</p>
<p dir="auto">Thanks for sharing the code. The issue is something internal to the <code>BinaryKits.Zpl.Viewer</code> assembly. Even though it’s definitely in the load path, any attempt to instantiate <code>IPrinterStorage</code> throws an exception. It can’t be debugged without installing the <code>BinaryKits.Zpl.Viewer</code> symbols package, assuming the <a href="https://github.com/BinaryKits/BinaryKits.Zpl" rel="nofollow ugc">BinaryKits.Zpl project</a> has published one.</p>
<p dir="auto">Try this:</p>
<pre><code class="language-cs"> namespace Kbg.NppPluginNET
 {
    // FIXME: instantiating IPrinterStorage throws an exception
    public class MyPrinterStorage // : BinaryKits.Zpl.Viewer.IPrinterStorage
    {
        public MyPrinterStorage()
        {
            MessageBox.Show(this.ToString());
        }
        public void AddFile(char storageDevice, string fileName, byte[] data) { }
        public byte[] GetFile(char storageDevice, string fileName) =&gt; new byte[0xFF];
        public override string ToString() =&gt; "Hello N++!";
    }

    class Main
    {
         // . .  .

         internal static void myMenuFunction()
         {
             MyPrinterStorage printerStorage = new MyPrinterStorage();
         }

    // . . .

    }

    // . . .
 }
</code></pre>
<p dir="auto">Confirm that <code>Plugins &gt; MyNppPlugin1 &gt; MyMenuCommand</code> runs OK.</p>
<p dir="auto">Now turn <code>MyPrinterStorage</code> into an instance of <code>IPrinterStorage</code>:</p>
<pre><code class="language-cs">    public class MyPrinterStorage : BinaryKits.Zpl.Viewer.IPrinterStorage
    {
    // . .  .
    }
</code></pre>
<p dir="auto">Confirm that <code>Plugins &gt; MyNppPlugin1 &gt; MyMenuCommand</code> throws an exception.</p>
<p dir="auto">I think you may be mixing incompatible Framework versions. Your best alternative would be including <code>BinaryKits.Zpl.Viewer</code> as a project reference and building it yourself.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88555</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88555</guid><dc:creator><![CDATA[rdipardo]]></dc:creator><pubDate>Sun, 13 Aug 2023 01:34:38 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 12 Aug 2023 15:18:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a> said in <a href="/post/88546">how to add/use external libraries in plugin</a>:</p>
<blockquote>
<p dir="auto">Thanks for looking into this. I got it on a high level but how come this <a href="https://github.com/BJSam/npp_plugin_tst/blob/8dcac2bf7f45bd1680e89525abc7f08db5578abe/MyNppPlugin1/Main.cs#L70" rel="nofollow ugc">line</a> is affecting the entire command, if I remove that line its working without any error, if I add that line I am getting error. if you have time pls look into the <a href="https://github.com/BJSam/npp_plugin_tst/tree/main" rel="nofollow ugc">proj</a></p>
</blockquote>
<p dir="auto">You will learn far more by doing the work yourself. It’s good that you seem to have isolated the issue to what seems like one line of code. Do debug dumps or debugger breakpoints to see if the values in your variables are what you expect them to be. Break the line down into smaller parts. Read the manuals and documentation carefully for each of the small parts you are dealing with. Maybe you have discovered someone else’s bug but more likely something is happening in the code that you did not expect or assume would happen.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88548</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88548</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Sat, 12 Aug 2023 15:18:40 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 12 Aug 2023 13:08:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rdipardo" aria-label="Profile: rdipardo">@<bdi>rdipardo</bdi></a> :</p>
<blockquote>
<p dir="auto">If PluginBase._funcItems or PluginBase._funcItems.Items is null, no .NET exception will be thrown. “Unmanaged” code fails like C++ would, with a segmentation fault, and nbF will be left uninitialized except for a random value like 14.</p>
</blockquote>
<p dir="auto">Thanks for looking into this. I got it on a high level but how come this <a href="https://github.com/BJSam/npp_plugin_tst/blob/8dcac2bf7f45bd1680e89525abc7f08db5578abe/MyNppPlugin1/Main.cs#L70" rel="nofollow ugc">line</a> is affecting the entire command, if I remove that line its working without any error, if I add that line I am getting error. if you have time pls look into the <a href="https://github.com/BJSam/npp_plugin_tst/tree/main" rel="nofollow ugc">proj</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/88546</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88546</guid><dc:creator><![CDATA[Joseph Samuel]]></dc:creator><pubDate>Sat, 12 Aug 2023 13:08:56 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 12 Aug 2023 13:03:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a><br />
I am not sure what you are saying I am new to these things (started .net with building this plugin). Yes I have pushed the code to git. pls look into it… <a href="https://github.com/BJSam/npp_plugin_tst/blob/8dcac2bf7f45bd1680e89525abc7f08db5578abe/MyNppPlugin1/Main.cs#L70" rel="nofollow ugc">https://github.com/BJSam/npp_plugin_tst/blob/8dcac2bf7f45bd1680e89525abc7f08db5578abe/MyNppPlugin1/Main.cs#L70</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/88545</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88545</guid><dc:creator><![CDATA[Joseph Samuel]]></dc:creator><pubDate>Sat, 12 Aug 2023 13:03:54 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 12 Aug 2023 09:09:55 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><img src="/assets/uploads/files/1691762562113-screenshot-2023-08-10-132827.png" alt="Screenshot 2023-08-10 132827.png" class=" img-fluid img-markdown" /></p>
</blockquote>
<p dir="auto">Let’s take a moment to consider what the error message dialog really means. It says that <code>14</code> was passed to <code>runPluginCommand</code>, referring to <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/4fb8845183122409ef738597c788d69e327acd46/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp#L651-L660" rel="nofollow ugc">this overload</a> of the <code>PluginsManager::runPluginCommand</code> method.</p>
<p dir="auto">What does that method do? It calls a function through a pointer that it finds using <code>i</code> to index an array of function pointers, <code>_pluginsCommands</code>.</p>
<p dir="auto">Does 14 seem like a valid index for a plugin with only a few commands? N++ is supposed to learn the correct number from <code>getFuncsArray</code>, a <a href="https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/4f7a4d427e988d2a02615c54b5f893f44696a6f7/Visual%20Studio%20Project%20Template%20C%23/PluginInfrastructure/UnmanagedExports.cs#L25" rel="nofollow ugc">core interface method</a> taking a pointer to an <code>int</code> (to receive the number of commands) and returning <a href="https://github.com/npp-plugins/plugintemplate/blob/d6f55e06cf3a614f14f8847cc27c3883fc16f881/src/PluginInterface.h#L62" rel="nofollow ugc">an array of pointers</a> to those commands.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a>, pay close attention to the <code>nbF</code> variable (or whatever your template calls it) in this method especially:</p>
<pre><code class="language-cs">  [DllExport(CallingConvention = CallingConvention.Cdecl)]
  static IntPtr getFuncsArray(ref int nbF)
  {
      nbF = PluginBase._funcItems.Items.Count;
      return PluginBase._funcItems.NativePointer;
  }
</code></pre>
<p dir="auto">If <code>PluginBase._funcItems</code> or <code>PluginBase._funcItems.Items</code> is <code>null</code>, no .NET exception will be thrown. “Unmanaged” code fails like C++ would, with a segmentation fault, and <code>nbF</code> will be left uninitialized except for a random value like 14.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88543</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88543</guid><dc:creator><![CDATA[rdipardo]]></dc:creator><pubDate>Sat, 12 Aug 2023 09:09:55 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 12 Aug 2023 06:51:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a></p>
<p dir="auto">Could it be that the C# GC (Garbage Collector) did its job too early!?<br />
Is your project publicly available somewhere?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88541</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88541</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 12 Aug 2023 06:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Fri, 11 Aug 2023 14:05:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: Mark-Olson">@<bdi>Mark-Olson</bdi></a></p>
<p dir="auto">Yes, I have tried breakpoint but if I add below line</p>
<pre><code>IPrinterStorage printerStorage = new PrinterStorage();
</code></pre>
<p dir="auto">compiler is not coming till that break point, if I remove the above line compiler is stopping at the break point, even if I dont remove below line</p>
<pre><code>using BinaryKits.Zpl.Viewer;
</code></pre>
<p dir="auto">The compiler is also coming <a href="https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/blob/4f7a4d427e988d2a02615c54b5f893f44696a6f7/Visual%20Studio%20Project%20Template%20C%23/PluginInfrastructure/UnmanagedExports.cs" rel="nofollow ugc">here</a>  but not sure what’s going on in there…</p>
<p dir="auto"><img src="/assets/uploads/files/1691762121336-screenshot-2023-08-11-192510.png" alt="Screenshot 2023-08-11 192510.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Also tried adding breakpoints in different .cs files, but till np++ loaded on screen compiler is stopping at break points but once np++ is fully loaded and when I click the plugin option(for my plugin) in np++, compiler is not stopping at any breakpoint. it straight up throws error as below (No error in console output).</p>
<p dir="auto"><img src="/assets/uploads/files/1691762562113-screenshot-2023-08-10-132827.png" alt="Screenshot 2023-08-10 132827.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/88526</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88526</guid><dc:creator><![CDATA[Joseph Samuel]]></dc:creator><pubDate>Fri, 11 Aug 2023 14:05:24 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Thu, 10 Aug 2023 12:46:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a><br />
Have you tried setting a breakpoint in the function that you want to debug and compiling in debug mode?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88505</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88505</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Thu, 10 Aug 2023 12:46:55 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Thu, 10 Aug 2023 08:17:40 GMT]]></title><description><![CDATA[<p dir="auto">@Alexander-Verbitsky, I have started a new project with <a href="https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net" rel="nofollow ugc">https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net</a> and I dont see any file not found error but I see below error in the np++ screen<br />
<img src="/assets/uploads/files/1691655163067-screenshot-2023-08-10-132827.png" alt="Screenshot 2023-08-10 132827.png" class=" img-fluid img-markdown" />  I dont see any error in the output log in visual studio. below is the only line I have added to the default code given by template <img src="/assets/uploads/files/1691655287028-screenshot-2023-08-10-134431.png" alt="Screenshot 2023-08-10 134431.png" class=" img-fluid img-markdown" /><br />
I am not sure how to check np++ logs. can you help me…?</p>
<p dir="auto">output log in visual studio</p>
<pre><code>'notepad++.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'notepad++.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Program Files\Notepad++\plugins\MyNppPlugin1\MyNppPlugin1.dll'. Symbols loaded.
'notepad++.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'notepad++.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'notepad++.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[11144] notepad++.exe: Program Trace' has exited with code 0 (0x0).
The program '[11144] notepad++.exe' has exited with code 0 (0x0).
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/88503</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88503</guid><dc:creator><![CDATA[Joseph Samuel]]></dc:creator><pubDate>Thu, 10 Aug 2023 08:17:40 GMT</pubDate></item><item><title><![CDATA[Reply to how to add&#x2F;use external libraries in plugin on Sat, 05 Aug 2023 13:15:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joseph-samuel" aria-label="Profile: Joseph-Samuel">@<bdi>Joseph-Samuel</bdi></a> Ah, thats all related to .NET stuff.</p>
<blockquote>
<p dir="auto">but still I get file not found error if I use the library</p>
</blockquote>
<p dir="auto">What is the source of this error? Is this .NET exception?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/88364</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/88364</guid><dc:creator><![CDATA[Roland Taverner]]></dc:creator><pubDate>Sat, 05 Aug 2023 13:15:41 GMT</pubDate></item></channel></rss>