本文整理汇总了Python中pypy.rlib.libffi.CDLL.getaddressindll方法的典型用法代码示例。如果您正苦于以下问题:Python CDLL.getaddressindll方法的具体用法?Python CDLL.getaddressindll怎么用?Python CDLL.getaddressindll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.rlib.libffi.CDLL
的用法示例。
在下文中一共展示了CDLL.getaddressindll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_func_fromaddr
# 需要导入模块: from pypy.rlib.libffi import CDLL [as 别名]
# 或者: from pypy.rlib.libffi.CDLL import getaddressindll [as 别名]
def test_func_fromaddr(self):
from _ffi import CDLL, types, FuncPtr
libm = CDLL(self.libm_name)
pow_addr = libm.getaddressindll('pow')
pow = FuncPtr.fromaddr(pow_addr, 'pow', [types.double, types.double],
types.double)
assert pow(2, 3) == 8
示例2: test_getaddressindll
# 需要导入模块: from pypy.rlib.libffi import CDLL [as 别名]
# 或者: from pypy.rlib.libffi.CDLL import getaddressindll [as 别名]
def test_getaddressindll(self):
import sys
from _ffi import CDLL
libm = CDLL(self.libm_name)
pow_addr = libm.getaddressindll('pow')
fff = sys.maxint*2-1
if sys.platform == 'win32':
fff = sys.maxint*2+1
assert pow_addr == self.pow_addr & fff
示例3: test_func_fromaddr2
# 需要导入模块: from pypy.rlib.libffi import CDLL [as 别名]
# 或者: from pypy.rlib.libffi.CDLL import getaddressindll [as 别名]
def test_func_fromaddr2(self):
if not self.iswin32:
skip("windows specific")
from _ffi import CDLL, types, FuncPtr
from _rawffi import FUNCFLAG_STDCALL
libm = CDLL(self.libm_name)
pow_addr = libm.getaddressindll('pow')
wrong_pow = FuncPtr.fromaddr(pow_addr, 'pow',
[types.double, types.double], types.double, FUNCFLAG_STDCALL)
try:
wrong_pow(2, 3) == 8
except ValueError, e:
assert e.message.startswith('Procedure called with')
示例4: test_getaddressindll
# 需要导入模块: from pypy.rlib.libffi import CDLL [as 别名]
# 或者: from pypy.rlib.libffi.CDLL import getaddressindll [as 别名]
def test_getaddressindll(self):
import sys
from _ffi import CDLL, types
libm = CDLL(self.libm_name)
pow_addr = libm.getaddressindll('pow')
assert pow_addr == self.pow_addr & (sys.maxint*2-1)