2018-05-18 03:58:28 +05:30
|
|
|
import ctypes, os, sys
|
2018-05-16 03:34:53 +05:30
|
|
|
|
2018-05-18 02:30:52 +05:30
|
|
|
def loadlibc():
|
|
|
|
libc = None
|
2018-05-19 05:19:06 +05:30
|
|
|
# os.environ['PATH'] = os.path.abspath(
|
|
|
|
# os.path.join(
|
|
|
|
# os.path.dirname(__file__), "../")) \
|
|
|
|
# + ';' \
|
|
|
|
# + os.environ['PATH']
|
|
|
|
# __file__ is this __init__.py
|
|
|
|
# This assumes that the repo's directory has not been modified
|
|
|
|
# and that
|
|
|
|
so = '/lib3ddevil1.so'
|
|
|
|
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
|
|
|
|
sharedlib = libdir + so
|
2018-05-18 02:30:52 +05:30
|
|
|
try:
|
|
|
|
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
|
|
|
except OSError as e:
|
|
|
|
print("Error loading dynamically linked library.\nOSError: " + str(e))
|
2018-05-18 05:28:45 +05:30
|
|
|
raise RuntimeError("Couldn't load %s" % sharedlib)
|
2018-05-18 03:37:17 +05:30
|
|
|
return libc
|
2018-05-16 03:34:53 +05:30
|
|
|
|
2018-05-18 03:58:28 +05:30
|
|
|
libc = loadlibc()
|