FunctionType 编辑

FunctionType represents C function.

Syntax

Returns a new CType object describing a C function.

CType FunctionType(
  abi,
  returnType[,
  argType1, ...]
);
Parameters
abi
The ABI type for the function; this is one of the ABI constants.
returnType
A CType indicating the type of the value returned by the function.
argType1... argTypeN
Zero or more CType objects indicating the types of each of the parameters passed into the C function.
Return value

CType describing the function type. The equivalent C function type declaration would be:

returnType (*) ([argType1, ..., argTypeN]);
Exceptions thrown
TypeError
ABI is not a valid ABI constants, or returnType or any of the argument types are not valid CType objects.

Properties

PropertyTypeDescription
abiOne of the ABI constantsThe ABI of the function. Read only.
argTypesCType[]A sealed array of the argument types. Read only.
returnTypeCTypeThe return type of the function. Read only.

Properties inherited from CType

These properties are available on all CType objects.

PropertyTypeDescription
nameString

The type's name. Read only.

For primitive types, this is just the name of the corresponding C type. For structure and opaque pointer types, this is simply the string that was passed to the constructor. For other function, pointer, and array types, this should be a valid C type expression.

ptrCTypeReturns a CType representing the data type "pointer to this type". This is the result of calling ctypes.PointerType(the_type). Read only.
sizeNumber

The size of the type, in bytes. This is the same value as the C sizeof. Read only.

Note: ctypes.void_t.size is undefined.

Method overview

Methods inherited from CType

CType array([n])
String toSource()
String toString()

FunctionType CData

FunctionType CData cannot be constructed. Function pointer is created with FunctionType.ptr.

CData functiontype.ptr([func]);
functiontype is FunctionType CType.
Parameters
func
A pointer value or JavaScript Function.
Return value

A CData representing the newly allocated function pointer.

Exceptions thrown
TypeError
func is not either pointer value or JavaScript Function.

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:101 次

字数:7117

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文