2018-05-17 15:28:28 -07:00
|
|
|
import ctypes, os, sys
|
2018-05-15 15:04:53 -07:00
|
|
|
|
2018-05-17 14:00:52 -07:00
|
|
|
def loadlibc():
|
|
|
|
libc = None
|
2018-05-18 16:49:06 -07:00
|
|
|
# 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-17 14:00:52 -07:00
|
|
|
try:
|
|
|
|
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
|
|
|
except OSError as e:
|
|
|
|
print("Error loading dynamically linked library.\nOSError: " + str(e))
|
2018-05-17 16:58:45 -07:00
|
|
|
raise RuntimeError("Couldn't load %s" % sharedlib)
|
2018-05-17 15:07:17 -07:00
|
|
|
return libc
|
2018-05-15 15:04:53 -07:00
|
|
|
|
2018-05-17 15:28:28 -07:00
|
|
|
libc = loadlibc()
|