Exemplo n.º 1
0
 def test_getaddressindll(self):
     import sys
     from _rawffi.alt import CDLL
     libm = CDLL(self.libm_name)
     pow_addr = libm.getaddressindll('pow')
     fff = sys.maxsize * 2 - 1
     assert pow_addr == self.pow_addr & fff
Exemplo n.º 2
0
 def test_func_fromaddr(self):
     from _rawffi.alt 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
Exemplo n.º 3
0
 def test_func_fromaddr(self):
     from _rawffi.alt 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
Exemplo n.º 4
0
 def test_getaddressindll(self):
     import sys
     from _rawffi.alt import CDLL
     libm = CDLL(self.libm_name)
     pow_addr = libm.getaddressindll('pow')
     fff = sys.maxsize*2-1
     assert pow_addr == self.pow_addr & fff
Exemplo n.º 5
0
 def test_getaddressindll(self):
     import sys
     from _rawffi.alt import CDLL
     libm = CDLL(self.libm_name)
     pow_addr = libm.getaddressindll('pow')
     fff = sys.maxint*2-1
     if sys.platform == 'win32' or sys.platform == 'darwin':
         fff = sys.maxint*2+1
     assert pow_addr == self.pow_addr & fff
Exemplo n.º 6
0
 def test_func_fromaddr2(self):
     if not self.iswin32:
         skip("windows specific")
     from _rawffi.alt 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')
Exemplo n.º 7
0
 def test_func_fromaddr2(self):
     # win64 doesn't have __stdcall
     if not self.iswin32 or self.iswin64:
         skip("windows 32-bit specific")
     from _rawffi.alt 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 as e:
         assert e.message.startswith('Procedure called with')
     else:
         assert 0, 'test must assert, wrong calling convention'