Library

この記事は技術レビューを必要としています。

この記事はまだ日本語に翻訳されていません。MDN の翻訳はボランティアによって行われています。是非 MDN に登録し、私たちの力になって下さい。

Draft
This page is not complete.

The Library object represents a native library loaded by the ctypes open() method. Its methods let you declare symbols exported by the library, and to manage the library.

Method overview

close();
CData declare(name, [abi, ], returnType[, argType1, ...]);

Methods

close()

Closes the library. You need to call this once you're done using the library.

close();
Parameters

None.

declare()

Declares an API from the native library, allowing it to be used from JavaScript. This can be used both for exported data symbols and for functions.

CData declare(
  name[,
  abi,
  returnType
  argType1,
  ...]
);
Parameters
name
The name of the symbol exported by the native library that is to be declared as usable from JavaScript
abi
The ABI used by the exported function; this will be ctypes.default_abi for most libraries, except for Windows libraries, which will be ctypes.winapi_abi or ctypes.stdcall_abi. See ABI constants. You don't need to provide this for exported data; it's only needed for function declarations.
returnType
The data type returned by the defined API, if it's a function. This parameter should not be provided if the API is an exported data symbol. For supported data types, see Data types.
argType1...argTypeN
Zero or more parameter types may be specified for the parameters of the function being declared. These should not be provided if the API is an exported data symbol rather than a function. For supported data types, see Data types.
Return value

A CData object representing the declared API.

Exceptions thrown
TypeError
The return type was specified as an array.

Document Tags and Contributors

Contributors to this page: Sheppy, kscarfone
最終更新者: kscarfone,