mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 05:42:59 +05:30
24 lines
807 B
Python
24 lines
807 B
Python
import ctypes, os, sys
|
|
|
|
def loadlibc():
|
|
libc = None
|
|
# 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
|
|
try:
|
|
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
|
except OSError as e:
|
|
print("Error loading dynamically linked library.\nOSError: " + str(e))
|
|
raise RuntimeError("Couldn't load %s" % sharedlib)
|
|
return libc
|
|
|
|
libc = loadlibc()
|