Example #1
0
 def test_windll(self):
     if os.name != 'nt':
         py.test.skip('Run only on windows')
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL('Kernel32.dll')
     sleep = dll.getpointer('Sleep',[types.uint], types.void)
     chain = ArgChain()
     chain.arg(10)
     sleep.call(chain, lltype.Void, is_struct=False)
Example #2
0
 def test_windll(self):
     if os.name != 'nt':
         py.test.skip('Run only on windows')
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL('Kernel32.dll')
     sleep = dll.getpointer('Sleep', [types.uint], types.void)
     chain = ArgChain()
     chain.arg(10)
     sleep.call(chain, lltype.Void, is_struct=False)
Example #3
0
 def test_by_ordinal2(self):
     """
     int __stdcall BBB_second_ordinal_function()
     {
         return 24;
     }
     """
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL(self.libfoo_name)
     f_by_name = dll.getpointer('BBB_second_ordinal_function' ,[],
                                   types.uint)
     f_by_ordinal = dll.getpointer_by_ordinal(2 ,[], types.uint)
     print dir(f_by_name)
     assert f_by_name.funcsym == f_by_ordinal.funcsym
     chain = ArgChain()
     assert 24 == f_by_ordinal.call(chain, lltype.Signed, is_struct=False)
Example #4
0
 def test_by_ordinal2(self):
     """
     RPY_EXPORTED
     int __stdcall BBB_second_ordinal_function()
     {
         return 24;
     }
     """
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL(self.libfoo_name)
     # __stdcall without a DEF file decorates the name with the number of bytes
     # that the callee will remove from the call stack
     f_by_name = dll.getpointer('_BBB_second_ordinal_function@0' ,[],
                                   types.uint)
     f_by_ordinal = dll.getpointer_by_ordinal(2 ,[], types.uint)
     print dir(f_by_name)
     assert f_by_name.funcsym == f_by_ordinal.funcsym
     chain = ArgChain()
     assert 24 == f_by_ordinal.call(chain, lltype.Signed, is_struct=False)
Example #5
0
 def test_by_ordinal2(self):
     """
     RPY_EXPORTED
     int __stdcall BBB_second_ordinal_function()
     {
         return 24;
     }
     """
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL(self.libfoo_name)
     # __stdcall without a DEF file decorates the name with the number of bytes
     # that the callee will remove from the call stack
     f_by_name = dll.getpointer('_BBB_second_ordinal_function@0', [],
                                types.uint)
     f_by_ordinal = dll.getpointer_by_ordinal(2, [], types.uint)
     print dir(f_by_name)
     assert f_by_name.funcsym == f_by_ordinal.funcsym
     chain = ArgChain()
     assert 24 == f_by_ordinal.call(chain,
                                    lltype.Signed,
                                    is_struct=False)
Example #6
0
 def test_by_ordinal2(self):
     """
     RPY_EXPORTED
     int __stdcall BBB_second_ordinal_function()
     {
         return 24;
     }
     """
     from rpython.rlib.libffi import WinDLL
     dll = WinDLL(self.libfoo_name)
     # __stdcall without a DEF file decorates the name with the number of bytes
     # that the callee will remove from the call stack
     # identical to __fastcall for amd64
     if IS_32_BIT:
         f_name = '_BBB_second_ordinal_function@0'
     else:
         f_name = 'BBB_second_ordinal_function'
     f_by_name = dll.getpointer(f_name, [], types.sint)
     f_by_ordinal = dll.getpointer_by_ordinal(2, [], types.sint)
     print dir(f_by_name)
     assert f_by_name.funcsym == f_by_ordinal.funcsym
     chain = ArgChain()
     assert 24 == f_by_ordinal.call(chain, rffi.INT, is_struct=False)