MCPcopy Create free account
hub / github.com/ActiveState/code / get_func

Function get_func

recipes/Python/577655_POSIX_Semaphore_FreeBSD/recipe-577655.py:13–22  ·  view source on GitHub ↗

Retrieve a function from a library, and set the data types.

(libname, funcname, restype=None, argtypes=())

Source from the content-addressed store, hash-verified

11ETIMEDOUT = 60 # Operation timed out
12
13def get_func(libname, funcname, restype=None, argtypes=()):
14 """Retrieve a function from a library, and set the data types."""
15 from ctypes import cdll
16
17 lib = cdll.LoadLibrary(libname)
18 func = getattr(lib, funcname)
19 func.argtypes = argtypes
20 func.restype = restype
21
22 return func
23
24class SemError(RuntimeError):
25 """Exception for errors raised by the Sem class."""

Callers 3

SemErrorClass · 0.70
SemClass · 0.70
dispatchMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected