本文整理匯總了Python中ctypes.cdll.m方法的典型用法代碼示例。如果您正苦於以下問題:Python cdll.m方法的具體用法?Python cdll.m怎麽用?Python cdll.m使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ctypes.cdll
的用法示例。
在下文中一共展示了cdll.m方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: find_library
# 需要導入模塊: from ctypes import cdll [as 別名]
# 或者: from ctypes.cdll import m [as 別名]
def find_library(name):
if name in ('c', 'm'):
return find_msvcrt()
# See MSDN for the REAL search order.
for directory in os.environ['PATH'].split(os.pathsep):
fname = os.path.join(directory, name)
if os.path.isfile(fname):
return fname
if fname.lower().endswith(".dll"):
continue
fname = fname + ".dll"
if os.path.isfile(fname):
return fname
return None
示例2: test
# 需要導入模塊: from ctypes import cdll [as 別名]
# 或者: from ctypes.cdll import m [as 別名]
def test():
from ctypes import cdll
if os.name == "nt":
print cdll.msvcrt
print cdll.load("msvcrt")
print find_library("msvcrt")
if os.name == "posix":
# find and load_version
print find_library("m")
print find_library("c")
print find_library("bz2")
# getattr
## print cdll.m
## print cdll.bz2
# load
if sys.platform == "darwin":
print cdll.LoadLibrary("libm.dylib")
print cdll.LoadLibrary("libcrypto.dylib")
print cdll.LoadLibrary("libSystem.dylib")
print cdll.LoadLibrary("System.framework/System")
else:
print cdll.LoadLibrary("libm.so")
print cdll.LoadLibrary("libcrypt.so")
print find_library("crypt")
示例3: test
# 需要導入模塊: from ctypes import cdll [as 別名]
# 或者: from ctypes.cdll import m [as 別名]
def test():
from ctypes import cdll
if os.name == "nt":
print(cdll.msvcrt)
print(cdll.load("msvcrt"))
print(find_library("msvcrt"))
if os.name == "posix":
# find and load_version
print(find_library("m"))
print(find_library("c"))
print(find_library("bz2"))
# getattr
## print cdll.m
## print cdll.bz2
# load
if sys.platform == "darwin":
print(cdll.LoadLibrary("libm.dylib"))
print(cdll.LoadLibrary("libcrypto.dylib"))
print(cdll.LoadLibrary("libSystem.dylib"))
print(cdll.LoadLibrary("System.framework/System"))
else:
print(cdll.LoadLibrary("libm.so"))
print(cdll.LoadLibrary("libcrypt.so"))
print(find_library("crypt"))
示例4: test
# 需要導入模塊: from ctypes import cdll [as 別名]
# 或者: from ctypes.cdll import m [as 別名]
def test():
from ctypes import cdll
if os.name == "nt":
sys.stdout.write('%s\n' % (cdll.msvcrt,))
sys.stdout.write('%s\n' % (cdll.load("msvcrt"),))
sys.stdout.write('%s\n' % (find_library("msvcrt"),))
if os.name == "posix":
# find and load_version
sys.stdout.write('%s\n' % (find_library("m"),))
sys.stdout.write('%s\n' % (find_library("c"),))
sys.stdout.write('%s\n' % (find_library("bz2"),))
# getattr
## print_ cdll.m
## print_ cdll.bz2
# load
if sys.platform == "darwin":
sys.stdout.write('%s\n' % (cdll.LoadLibrary("libm.dylib"),))
sys.stdout.write('%s\n' % (cdll.LoadLibrary("libcrypto.dylib"),))
sys.stdout.write('%s\n' % (cdll.LoadLibrary("libSystem.dylib"),))
sys.stdout.write('%s\n' % (cdll.LoadLibrary("System.framework/System"),))
else:
sys.stdout.write('%s\n' % (cdll.LoadLibrary("libm.so"),))
sys.stdout.write('%s\n' % (cdll.LoadLibrary("libcrypt.so"),))
sys.stdout.write('%s\n' % (find_library("crypt"),))