FunctionType

Draft
This page is not complete.

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 type, or returnType or any of the argument types are not valid CType 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 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

Document Tags and Contributors

 Contributors to this page: rolfedh, arai, Noitidart
 Last updated by: rolfedh,