This page is not complete.
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.
Closes the library. You need to call this once you're done using the library.
CData declare( name[, abi, returnType argType1, ...] );
ABI used by the exported function; this will be
ctypes.default_abi for most libraries, except for Windows libraries, which will be
ctypes.stdcall_abi. See ABI constants. You don't need to provide this for exported data; it's only needed for function declarations.
CType 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.
CType 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.
CData object representing the declared API.
Another use for ctypes.declare is to get non-function/non-methods from libraries. The syntax for this is seen in Firefox codebase here:
This shows that we can also supply only two arguments to the declare function. The first being the same as in the above example, name, which is the name of the symbol to export. And in place of the abi argument, we will pass in the type of this export. For example, from the Objective-C library we can export the symbol which holds the address to an external block. This would be done like this:
var objc = ctypes.open(ctypes.libraryName('objc')); objc.declare('_NSConcreteGlobalBlock', ctypes.voidptr_t);