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")
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"),))
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"), ))
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': print find_library('m') print find_library('c') print find_library('bz2') 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')
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")) elif sys.platform == "cygwin": print(cdll.LoadLibrary("cygbz2-1.dll")) print(cdll.LoadLibrary("cygcrypt-0.dll")) print(find_library("crypt")) elif sys.platform == "msys": print(cdll.LoadLibrary("msys-bz2-1.dll")) print(cdll.LoadLibrary("msys-crypt-0.dll")) print(find_library("crypt")) # 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"))
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"))