ctypes.jsm

  • Revision slug: JavaScript_code_modules/ctypes.jsm
  • Revision title: ctypes.jsm
  • Revision id: 71806
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 16 words added

Revision Content

{{ gecko_minversion_header("2") }}

The ctypes.jsm JavaScript code module makes it possible to call C-compatible foreign library functions from JavaScript code without having to write your own binary XPCOM component.

{{ note("The ctypes.jsm JavaScript code module can only be used from chrome -- that is, from within the application itself or an add-on.") }}

To use ctypes, you first need to import the code module into your JavaScript scope:

Components.utils.import("resource://gre/modules/ctypes.jsm")

Once you've imported the module, you can then use it to load a foreign library. For details on how to use js-ctypes, see Using js-ctypes.

See also

{{ languages({ "ja": "ja/JavaScript_code_modules/ctypes.jsm" }) }}

Revision Source

<p>{{ gecko_minversion_header("2") }}</p>
<p>The <code>ctypes.jsm</code> JavaScript code module makes it possible to call C-compatible foreign library functions from JavaScript code without having to write your own binary XPCOM component.</p>
<p>{{ note("The <code>ctypes.jsm</code> JavaScript code module can only be used from chrome -- that is, from within the application itself or an add-on.") }}</p>
<p>To use ctypes, you first need to import the code module into your JavaScript scope:</p>
<pre class="eval"><span class="nowiki">Components.utils.import("resource://gre/modules/ctypes.jsm")</span></pre>
<p>Once you've imported the module, you can then use it to load a foreign library. For details on how to use js-ctypes, see <a href="/en/js-ctypes/Using_js-ctypes" title="en/js-ctypes/Using js-ctypes">Using js-ctypes</a>.</p>
<h2>See also</h2>
<ul> <li><a class="internal" href="/en/JavaScript/Code_modules/Using" title="en/JavaScript code modules/Using
    JavaScript code modules">Using JavaScript code modules</a></li> <li><a class="internal" href="/en/JavaScript/Code_modules" title="en/JavaScript code modules">JavaScript code modules</a></li> <li><a class="internal" href="/en/Components.utils.import" title="en/Components.utils.import"><code>Components.utils.import</code></a></li> <li><a href="/en/js-ctypes" title="en/js-ctypes">js-ctypes</a></li> <li><a href="/en/js-ctypes/Using_js-ctypes" title="en/js-ctypes/Using js-ctypes">Using js-ctypes</a></li> <li><a href="/en/js-ctypes/js-ctypes_reference" title="en/js-ctypes/js-ctypes reference">js-ctypes reference</a></li>
</ul>
<p>{{ languages({ "ja": "ja/JavaScript_code_modules/ctypes.jsm" }) }}</p>
Revert to this revision