Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_lib(path=None):
"""Loads the libknot library."""
if path is None:
version = ""
try:
from libknot import LIBKNOT_VERSION
version = ".%u" % int(LIBKNOT_VERSION)
except:
pass
if sys.platform == "darwin":
path = "libknot%s.dylib" % version
else:
path = "libknot.so%s" % version
LIB = cdll.LoadLibrary(path)
global CTL_ALLOC
CTL_ALLOC = LIB.knot_ctl_alloc
CTL_ALLOC.restype = c_void_p
global CTL_FREE
CTL_FREE = LIB.knot_ctl_free
CTL_FREE.argtypes = [c_void_p]