title: Calling a C dll through chrome browser extension
body: <p>I want to access smart card through <code>winscard.dll</code> by a chrome extension.</p>
  
  <p>I am new in Chrome extension developing, however as I know a chrome extension in the unpacked mode is a folder consist of some html pages (background, ordinary, optinal, override, tabs.create/window.open and so on) and javaScript files (content script and other files) which communicating with each other. These various files make me confused and need step by step guiding.</p>
  
  <p>In the firs step, how can I call a C++ dll from chrome browser extension?</p>
  
  <p>Already I did this in Firefox add-on using <code>js-ctypes</code>.
  Is it similar to Firefox approach?</p>
  
  <p>One approach which explain in <a href="https://stackoverflow.com/questions/13511805/how-to-call-exported-function-in-a-dllwritten-using-c-from-chrome-extensions">How to call exported function in a DLL(written using C), from chrome extensions</a> provide calling dll through adding the following code to manifest.json:</p>
  
  <pre><code>"plugins": [{ "path": "FRViewPortExtn.dll", "public": true },], ...
  </code></pre>
  
  <p>However I think due to deprecating plugin NPAPI in chrome, it is not applicable anymore.</p>
  
  <p>Another approach is using <code>Native Messaging</code> which introduce in <a href="https://developer.chrome.com/extensions/nativeMessaging" rel="nofollow noreferrer">https://developer.chrome.com/extensions/nativeMessaging</a> . I study the example of this tutorial page and found that it does forced clients to use a bat file (or executable file).</p>
  
  <p>Also as mentioned in comments a similar question asked in
  <a href="https://stackoverflow.com/questions/21163880/loading-dll-from-chrome-extension">Loading dll from Chrome extension</a>
  However the answer only recommend using native messaging without any sample code which indicate calling a dll and using a function of this dll</p>