mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-12-22 13:29:46 +05:30
Moved out repeated code to __init__ & .so loaded once only
This commit is contained in:
parent
d8e1c45156
commit
2c44adf7a2
@ -0,0 +1,13 @@
|
||||
import sys, ctypes
|
||||
|
||||
sharedlib = './lib3ddevil1.so'
|
||||
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
||||
if not libc:
|
||||
print("Couldn't load %s" % sharedlib)
|
||||
sys.exit()
|
||||
|
||||
# Observe how many times the .so is loaded.
|
||||
print("\nlib3ddevil1 loaded.")
|
||||
|
||||
# Don't need these anymore
|
||||
del sys, sharedlib
|
@ -1,6 +1,8 @@
|
||||
from py3devil1pld import *
|
||||
from py3devil1tex import *
|
||||
from py3devil1geo import *
|
||||
from py3devil1pld import PLDHeader
|
||||
from py3devil1tex import TEXturePack, TEXtureBatchDescriptor, TEXtureBatch
|
||||
from py3devil1geo import GEOHeader, MEShHeader, MEsh
|
||||
|
||||
#print(libc)
|
||||
|
||||
#--------------------------------------+
|
||||
# Regular Python
|
||||
|
@ -1,14 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
import ctypes, sys
|
||||
|
||||
sharedlib = './lib3ddevil1.so'
|
||||
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
||||
if not libc:
|
||||
print("Couldn't load %s" % sharedlib)
|
||||
sys.exit()
|
||||
del sys
|
||||
|
||||
print("\nlib3ddevil1 loaded.")
|
||||
import ctypes
|
||||
from __init__ import libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Basic Struct
|
||||
@ -143,6 +135,7 @@ class Devil1GEO_FN(ctypes.Structure):
|
||||
]
|
||||
|
||||
devil1geo = Devil1GEO_FN.in_dll(libc, "DEVIL1GEO")
|
||||
del libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Pythonic Object
|
||||
|
@ -1,13 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
import ctypes, sys
|
||||
|
||||
sharedlib = './lib3ddevil1.so'
|
||||
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
||||
if not libc:
|
||||
print("Couldn't load %s" % sharedlib)
|
||||
sys.exit()
|
||||
del sys
|
||||
print("\nlib3ddevil1 loaded.")
|
||||
import ctypes
|
||||
from __init__ import libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Basic Struct
|
||||
@ -35,6 +28,7 @@ class Devil1PLD_FN(ctypes.Structure):
|
||||
]
|
||||
|
||||
devil1pld = Devil1PLD_FN.in_dll(libc, "DEVIL1PLD")
|
||||
del libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Pythonic Object
|
||||
|
@ -1,14 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
import ctypes, sys
|
||||
|
||||
sharedlib = './lib3ddevil1.so'
|
||||
libc = ctypes.cdll.LoadLibrary(sharedlib)
|
||||
if not libc:
|
||||
print("Couldn't load %s" % sharedlib)
|
||||
sys.exit()
|
||||
del sys
|
||||
|
||||
print("\nlib3ddevil1 loaded.")
|
||||
import ctypes
|
||||
from __init__ import libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Basic Struct
|
||||
@ -82,6 +74,7 @@ class Devil1TEX_FN(ctypes.Structure):
|
||||
]
|
||||
|
||||
devil1tex = Devil1TEX_FN.in_dll(libc, "DEVIL1TEX")
|
||||
del libc
|
||||
|
||||
#--------------------------------------+
|
||||
# Pythonic Object
|
||||
|
Loading…
Reference in New Issue
Block a user