But there are cross-platform considerations, such as library file extensions,
plus the fact Windows will just load the first library it finds with that name.
NumPy supplies the load_library function as a convenience.
Parameters:
libname : path-like
Name of the library, which can have ‘lib’ as a prefix,
but without an extension.
loader_path : path-like
Where the library can be found.
Returns:
ctypes.cdll[libpath] : library object
A ctypes library object
Raises:
OSError
If there is no library with the expected extension, or the
library is defective and cannot be loaded.
An ndpointer instance is used to describe an ndarray in restypes
and argtypes specifications. This approach is more flexible than
using, for example, POINTER(c_double), since several restrictions
can be specified, which are verified upon calling the ctypes function.
These include data type, number of dimensions, shape and flags. If a
given array does not satisfy the specified restrictions,
a TypeError is raised.
Parameters:
dtype : data-type, optional
Array data-type.
ndim : int, optional
Number of array dimensions.
shape : tuple of ints, optional
Array shape.
flags : str or tuple of str
Array flags; may be one or more of:
C_CONTIGUOUS / C / CONTIGUOUS
F_CONTIGUOUS / F / FORTRAN
OWNDATA / O
WRITEABLE / W
ALIGNED / A
WRITEBACKIFCOPY / X
Returns:
klass : ndpointer type object
A type object, which is an _ndtpr instance containing
dtype, ndim, shape and flags information.
Raises:
TypeError
If a given array does not satisfy the specified restrictions.