[pypy-commit] pypy win-ordinal: add test, fix for test
mattip
noreply at buildbot.pypy.org
Wed Jun 6 18:31:03 CEST 2012
Author: Matti Picus <matti.picus at gmail.com>
Branch: win-ordinal
Changeset: r55441:3a437ffcadd4
Date: 2012-06-06 19:26 +0300
http://bitbucket.org/pypy/pypy/changeset/3a437ffcadd4/
Log: add test, fix for test
diff --git a/pypy/rlib/libffi.py b/pypy/rlib/libffi.py
--- a/pypy/rlib/libffi.py
+++ b/pypy/rlib/libffi.py
@@ -428,10 +428,10 @@
def getpointer(self, name, argtypes, restype, flags=FUNCFLAG_STDCALL):
return Func(name, argtypes, restype, dlsym(self.lib, name),
flags=flags, keepalive=self)
- def getpointer_by_ordinal(self, name, argtypes, restype,
- flags=FUNCFLAG_STDCALL):
- return Func(name, argtypes, restype, dlsym_byordinal(self.lib, name),
- flags=flags, keepalive=self)
+ def getpointer_by_ordinal(self, name, argtypes, restype,
+ flags=FUNCFLAG_STDCALL):
+ return Func(name, argtypes, restype, dlsym_byordinal(self.lib, name),
+ flags=flags, keepalive=self)
# ======================================================================
diff --git a/pypy/rlib/test/test_libffi.py b/pypy/rlib/test/test_libffi.py
--- a/pypy/rlib/test/test_libffi.py
+++ b/pypy/rlib/test/test_libffi.py
@@ -589,5 +589,22 @@
print dir(f_by_name)
assert f_by_name.funcsym == f_by_ordinal.funcsym
+ def test_by_ordinal2(self):
+ """
+ int __stdcall BBB_second_ordinal_function()
+ {
+ return 24;
+ }
+ """
+ from pypy.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)
+
More information about the pypy-commit
mailing list