[pypy-svn] r49187 - in pypy/dist/pypy: doc rpython/module

xoraxax at codespeak.net xoraxax at codespeak.net
Tue Nov 27 21:45:55 CET 2007


Author: xoraxax
Date: Tue Nov 27 21:45:54 2007
New Revision: 49187

Modified:
   pypy/dist/pypy/doc/rffi.txt
   pypy/dist/pypy/rpython/module/ll_os_environ.py
Log:
(tav): Fixed rffi docs about llexternals and fixed os_environ on darwin.


Modified: pypy/dist/pypy/doc/rffi.txt
==============================================================================
--- pypy/dist/pypy/doc/rffi.txt	(original)
+++ pypy/dist/pypy/doc/rffi.txt	Tue Nov 27 21:45:54 2007
@@ -12,23 +12,38 @@
 Declaring low-level external function
 -------------------------------------
 
-Declaring external C function in RPython is easy, but one need to
-remember that low level functions eats low level types (like
+Declaring external C function in RPython is easy, but one needs to
+remember that low level functions eat low level types (like
 lltype.Signed or lltype.Array) and memory management must be done
 by hand. To declare a function, we write::
 
   from pypy.rpython.lltypesystem import rffi
 
-  external_function = rffi.llexternal(name, args, result, includes=[], sources=[])
+  external_function = rffi.llexternal(name, args, result)
 
 where:
 
 * name - a C-level name of a function (how it would be rendered)
 * args - low level types of args
 * result - low level type of a result
-* includes - additional C-level includes
-* sources - additional C-level sources, needed to be compiled into 
-  executable
+
+You can pass in additional information about C-level includes,
+libraries and sources by passing in the optional ``compilation_info``
+parameter::
+
+  from pypy.rpython.lltypesystem import rffi
+  from pypy.translator.tool.cbuild import ExternalCompilationInfo
+
+  info = ExternalCompilationInfo(includes=[], libraries=[])
+
+  external_function = rffi.llexternal(
+    name, args, result, compilation_info=info
+    )
+
+See cbuild_ for more info on ExternalCompilationInfo.
+
+.. _cbuild: http://codespeak.net/svn/pypy/dist/pypy/translator/tool/cbuild.py
+
 
 Types
 ------

Modified: pypy/dist/pypy/rpython/module/ll_os_environ.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os_environ.py	(original)
+++ pypy/dist/pypy/rpython/module/ll_os_environ.py	Tue Nov 27 21:45:54 2007
@@ -136,8 +136,10 @@
 
 if sys.platform.startswith('darwin'):
     CCHARPPP = rffi.CArrayPtr(rffi.CCHARPP)
-    _os_NSGetEnviron = rffi.llexternal('_NSGetEnviron', [], CCHARPPP,
-                                       includes=['crt_externs.h'])
+    _os_NSGetEnviron = rffi.llexternal(
+        '_NSGetEnviron', [], CCHARPPP,
+        compilation_info=ExternalCompilationInfo(includes=['crt_externs.h'])
+        )
     def os_get_environ():
         return _os_NSGetEnviron()[0]
 else:



More information about the Pypy-commit mailing list