本文整理汇总了Python中ctypes.cdll.msvcrt方法的典型用法代码示例。如果您正苦于以下问题:Python cdll.msvcrt方法的具体用法?Python cdll.msvcrt怎么用?Python cdll.msvcrt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ctypes.cdll
的用法示例。
在下文中一共展示了cdll.msvcrt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_msvcrt
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [as 别名]
def find_msvcrt():
"""Return the name of the VC runtime dll"""
version = _get_build_version()
if version is None:
# better be safe than sorry
return None
if version <= 6:
clibname = 'msvcrt'
else:
clibname = 'msvcr%d' % (version * 10)
# If python was built with in debug mode
import imp
if imp.get_suffixes()[0][0] == '_d.pyd':
clibname += 'd'
return clibname+'.dll'
示例2: find_msvcrt
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [as 别名]
def find_msvcrt():
"""Return the name of the VC runtime dll"""
version = _get_build_version()
if version is None:
# better be safe than sorry
return None
if version <= 6:
clibname = 'msvcrt'
elif version <= 13:
clibname = 'msvcr%d' % (version * 10)
else:
# CRT is no longer directly loadable. See issue23606 for the
# discussion about alternative approaches.
return None
# If python was built with in debug mode
import importlib.machinery
if '_d.pyd' in importlib.machinery.EXTENSION_SUFFIXES:
clibname += 'd'
return clibname+'.dll'
示例3: find_msvcrt
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [as 别名]
def find_msvcrt():
#************************************************************
# FIXME: For GCC(mingw) runtime don't depend from compiler
# version ;). We may use -D__MSVCRT_VERSION__ to detect which
# verion is requested by user, but the name of the library
# to be default.
# As example WXP is with version 7.0 of msvcrt.dll.
# Anyway since _get_build_version return 6 in most(standard)
# cases this method will return msvcrt{d}. May be not so bad.
#************************************************************
"""Return the name of the VC runtime dll"""
version = _get_build_version()
if version is None:
# better be safe than sorry
return None
if version <= 6:
clibname = 'msvcrt'
else:
clibname = 'msvcr%d' % (version * 10)
# If python was built with in debug mode
import imp
if imp.get_suffixes()[0][0] == '_d.pyd':
clibname += 'd'
return clibname+'.dll'
示例4: find_msvcrt
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [as 别名]
def find_msvcrt():
"""Return the name of the VC runtime dll"""
version = _get_build_version()
if version is None:
# better be safe than sorry
return None
if version <= 6:
clibname = 'msvcrt'
else:
clibname = 'msvcr%d' % (version * 10)
# If python was built with in debug mode
import importlib.machinery
if '_d.pyd' in importlib.machinery.EXTENSION_SUFFIXES:
clibname += 'd'
return clibname+'.dll'
示例5: test
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [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")
示例6: test
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [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"))
示例7: test
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [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"),))
示例8: test
# 需要导入模块: from ctypes import cdll [as 别名]
# 或者: from ctypes.cdll import msvcrt [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"))
# 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"))
# issue-26439 - fix broken test call for AIX
elif sys.platform.startswith("aix"):
from ctypes import CDLL
if sys.maxsize < 2**32:
print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr.o)', os.RTLD_MEMBER)}")
print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr.o)')}")
# librpm.so is only available as 32-bit shared library
print(find_library("rpm"))
print(cdll.LoadLibrary("librpm.so"))
else:
print(f"Using CDLL(name, os.RTLD_MEMBER): {CDLL('libc.a(shr_64.o)', os.RTLD_MEMBER)}")
print(f"Using cdll.LoadLibrary(): {cdll.LoadLibrary('libc.a(shr_64.o)')}")
print(f"crypt\t:: {find_library('crypt')}")
print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}")
print(f"crypto\t:: {find_library('crypto')}")
print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}")
else:
print(cdll.LoadLibrary("libm.so"))
print(cdll.LoadLibrary("libcrypt.so"))
print(find_library("crypt"))