library.py
Others:
Bases: foundations.dataStructures.Structure
Defines a library hook used by the Library class to bind target library functions.
Initializes the class.
Usage:
LibraryHook(name="FreeImage_GetVersion", argumentsTypes=None, returnValue=ctypes.c_char_p)
Parameters: |
|
---|
Bases: object
Initializes the class.
Usage:
>>> import ctypes
>>> path = "FreeImage.dll"
>>> functions = (LibraryHook(name="FreeImage_GetVersion", argumentsTypes=None, returnValue=ctypes.c_char_p),)
>>> library = Library(path, functions)
>>> library.FreeImage_GetVersion()
'3.15.1'
Parameters: |
---|
Parameters: | callback (ctypes.CFUNCTYPE) – callback. |
---|
alias of CFunctionType
Property for self.__instances attribute.
Returns: | self.__instances. |
---|---|
Return type: | WeakValueDictionary |
Property for self.__initialized attribute.
Returns: | self.__initialized. |
---|---|
Return type: | unicode |
Property for self.__functions attribute.
Returns: | self.__functions. |
---|---|
Return type: | tuple |
Binds given function to a class object attribute.
Usage:
>>> import ctypes
>>> path = "FreeImage.dll"
>>> function = LibraryHook(name="FreeImage_GetVersion", argumentsTypes=None, returnValue=ctypes.c_char_p)
>>> library = Library(path, bindLibrary=False)
>>> library.bindFunction(function)
True
>>> library.FreeImage_GetVersion()
'3.15.1'
Parameters: | function (LibraryHook) – Function to bind. |
---|---|
Returns: | Method success. |
Return type: | bool |
Binds the Library using functions registered in the self.__functions attribute.
Usage:
>>> import ctypes
>>> path = "FreeImage.dll"
>>> functions = (LibraryHook(name="FreeImage_GetVersion", argumentsTypes=None, returnValue=ctypes.c_char_p),)
>>> library = Library(path, functions, bindLibrary=False)
>>> library.bindLibrary()
True
>>> library.FreeImage_GetVersion()
'3.15.1'
Returns: | Method success. |
---|---|
Return type: | bool |