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
A 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 validCType
objects.
Properties
Property | Type | Description |
abi | One of the ABI constants | The ABI of the function. Read only. |
argTypes | CType[] | A sealed array of the argument types. Read only. |
returnType | CType | The return type of the function. Read only. |
Properties inherited from CType
These properties are available on all CType
objects.
Property | Type | Description |
name | String | 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. |
ptr | CType | Returns a CType representing the data type "pointer to this type". This is the result of calling ctypes.PointerType(the_type) . Read only. |
size | Number | The size of the type, in bytes. This is the same value as the C 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 JavaScriptFunction
.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论