本文整理汇总了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"),))