[pypy-svn] r45052 - in pypy/dist/pypy/rpython/lltypesystem: . test
fijal at codespeak.net
fijal at codespeak.net
Sat Jul 14 11:16:32 CEST 2007
Author: fijal
Date: Sat Jul 14 11:16:32 2007
New Revision: 45052
Modified:
pypy/dist/pypy/rpython/lltypesystem/rffi.py
pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
Log:
(simonb, fijal) Pass around include_dirs to be able to specify new extra
includes in rffi.llexternal
Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py Sat Jul 14 11:16:32 2007
@@ -18,12 +18,14 @@
def lltype(self):
return self.TP
-def llexternal(name, args, result, _callable=None, sources=[], includes=[], libraries=[]):
+def llexternal(name, args, result, _callable=None, sources=[], includes=[],
+ libraries=[], include_dirs=[]):
ext_type = lltype.FuncType(args, result)
funcptr = lltype.functionptr(ext_type, name, external='C',
sources=tuple(sources),
includes=tuple(includes),
libraries=tuple(libraries),
+ include_dirs=tuple(include_dirs),
_callable=_callable)
if _callable is None:
from pypy.rpython.lltypesystem import ll2ctypes
Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_rffi.py Sat Jul 14 11:16:32 2007
@@ -173,3 +173,25 @@
res = interpret(f, [])
assert res == 3
+
+def test_extra_include_dirs():
+ udir.ensure("incl", dir=True)
+ udir.join("incl", "incl.h").write("#define C 3")
+ c_file = udir.join("test_extra_include_dirs.c")
+ c_source = """
+ #include <incl.h>
+ int fun ()
+ {
+ return (C);
+ }
+ """
+ c_file.write(c_source)
+ z = llexternal('fun', [], Signed, sources=[str(c_file)], include_dirs=
+ [str(udir.join("incl"))])
+
+ def f():
+ return z()
+
+ res = compile(f, [])
+ assert res() == 3
+
More information about the Pypy-commit
mailing list